anchor.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <title></title>
  7. <style type="text/css">
  8. * {
  9. color: #838383;
  10. margin: 0;
  11. padding: 0
  12. }
  13. html, body {
  14. font-size: 12px;
  15. overflow: hidden;
  16. }
  17. .content {
  18. padding: 5px 0 0 15px;
  19. }
  20. input {
  21. width: 210px;
  22. height: 21px;
  23. line-height: 21px;
  24. margin-left: 4px;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div class="content">
  30. <span><var id="lang_input_anchorName"></var></span><input id="anchorName" value=""/>
  31. </div>
  32. <script type="text/javascript" src="../internal.js"></script>
  33. <script type="text/javascript">
  34. var anchorInput = $G('anchorName'),
  35. node = editor.selection.getRange().getClosedNode();
  36. if (node && node.tagName == 'IMG' && (node = node.getAttribute('anchorname'))) {
  37. anchorInput.value = node;
  38. }
  39. anchorInput.onkeydown = function (evt) {
  40. evt = evt || window.event;
  41. if (evt.keyCode == 13) {
  42. editor.execCommand('anchor', anchorInput.value);
  43. dialog.close();
  44. domUtils.preventDefault(evt)
  45. }
  46. };
  47. dialog.onok = function () {
  48. editor.execCommand('anchor', anchorInput.value);
  49. dialog.close();
  50. };
  51. $focus(anchorInput);
  52. </script>
  53. </body>
  54. </html>