drag-image.html 690 B

1234567891011121314151617181920212223242526
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function debug(str) {
  6. var c = document.getElementById('console')
  7. c.appendChild(document.createTextNode(str + '\n'));
  8. }
  9. var i = new Image()
  10. i.src ="resources/webkit-background.png";
  11. function dragStartHandler() {
  12. event.dataTransfer.setDragImage(i, 10, 10);
  13. }
  14. </script>
  15. </head>
  16. <body onload="runTests();">
  17. <p>This tests that setting the drag image works. If this is successful, the drag icon when dragging the text below around should look like the image below.</p>
  18. <img src="resources/webkit-background.png">
  19. <div ondragstart="dragStartHandler()" draggable="true">Try dragging me around!</div>
  20. <pre id="console">
  21. </pre>
  22. </body>
  23. </html>