capture.html 914 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta name="author" content="Fabian Jakobs">
  7. <!-- Date: 2010-04-07 -->
  8. <style type="text/css" media="screen">
  9. #juhu {
  10. width: 100px;
  11. height: 50px;
  12. background: yellow;
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <div id="juhu">
  18. </div>
  19. <script src="../src/ace.js" type="text/javascript" charset="utf-8"></script>
  20. <script type="text/javascript" charset="utf-8">
  21. var el = document.getElementById("juhu");
  22. ace.addListener(el, "mousedown", function(e) {
  23. el.innerHTML = ace.getDocumentX(e) + " " + ace.getDocumentY(e);
  24. ace.capture(
  25. el,
  26. function(e) {
  27. el.innerHTML = ace.getDocumentX(e) + " " + ace.getDocumentY(e);
  28. }, function() {
  29. el.innerHTML = "";
  30. }
  31. );
  32. });
  33. </script>
  34. </body>
  35. </html>