Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <a id="bmpFormat">.BMP</a>
  2.  
  3. <script>
  4. var exportBMPElement = document.getElementById('bmpFormat');
  5.  
  6. exportBMPElement.addEventListener('click', function(e) {
  7. map.once('postcompose', function(event) {
  8. var canvas = event.context.canvas;
  9. exportBMPElement.download = 'mapa.bmp'
  10. exportBMPElement.href = canvas.toDataURL('image/bmp');
  11. });
  12. }
  13. </script>
  14.  
  15. <div class="modal>
  16. <form id="exportMapForm" action="javascript:doExportMap()" role="form">
  17. </form>
  18. </div>
  19.  
  20. function doExportMap() {
  21. var a = document.createElement('a');
  22. a.download = 'tux.png';
  23. a.href = 'http://mail.rsgc.on.ca/~ldevir/ICS3U/Chapter4/Images/tux.png';
  24. a.click();
  25. }
  26.  
  27. document.getElementById("exportMapForm").appendChild(a);
  28.  
  29. function doExportMap() {
  30. var a = document.createElement('a');
  31. a.download = 'tux.png';
  32. a.href = 'http://mail.rsgc.on.ca/~ldevir/ICS3U/Chapter4/Images/tux.png';
  33. document.body.appendChild(a);
  34. a.click();
  35. document.body.removeChild(a);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement