anchor.html 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. *{color: #838383;margin: 0;padding: 0}
  9. html,body {font-size: 12px;overflow: hidden; }
  10. .content{padding:15px 0 0 15px;}
  11. input{width:210px;height:28px;line-height:28px;margin-left: 4px;border-radius: 5px;border: 1px solid #ccc;}
  12. </style>
  13. </head>
  14. <body>
  15. <div class="content">
  16. <span><var id="lang_input_anchorName"></var></span><input id="anchorName" value="" />
  17. </div>
  18. <script type="text/javascript" src="../internal.js"></script>
  19. <script type="text/javascript">
  20. var anchorInput = $G('anchorName'),
  21. node = editor.selection.getRange().getClosedNode();
  22. if(node && node.tagName == 'IMG' && (node = node.getAttribute('anchorname'))){
  23. anchorInput.value = node;
  24. }
  25. anchorInput.onkeydown = function(evt){
  26. evt = evt || window.event;
  27. if(evt.keyCode == 13){
  28. editor.execCommand('anchor', anchorInput.value);
  29. dialog.close();
  30. domUtils.preventDefault(evt)
  31. }
  32. };
  33. dialog.onok = function (){
  34. editor.execCommand('anchor', anchorInput.value);
  35. dialog.close();
  36. };
  37. $focus(anchorInput);
  38. </script>
  39. </body>
  40. </html>