You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
4.2 KiB

3 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <title></title>
  6. <script type="text/javascript" src="../internal.js"></script>
  7. <style type="text/css">
  8. .warp {width: 320px;height: 153px;margin-left:5px;padding: 20px 0 0 15px;position: relative;}
  9. #url {width: 290px; margin-bottom: 2px; margin-left: -6px; margin-left: -2px\9;*margin-left:0;_margin-left:0; }
  10. .format span{display: inline-block; width: 58px;text-align: center; zoom:1;}
  11. table td{padding:5px 0;}
  12. #align{width: 65px;height: 23px;line-height: 22px;}
  13. </style>
  14. </head>
  15. <body>
  16. <div class="warp">
  17. <table width="300" cellpadding="0" cellspacing="0">
  18. <tr>
  19. <td colspan="2" class="format">
  20. <span><var id="lang_input_address"></var></span>
  21. <input style="width:200px" id="url" type="text" value=""/>
  22. </td>
  23. </tr>
  24. <tr>
  25. <td colspan="2" class="format"><span><var id="lang_input_width"></var></span><input style="width:200px" type="text" id="width"/> px</td>
  26. </tr>
  27. <tr>
  28. <td colspan="2" class="format"><span><var id="lang_input_height"></var></span><input style="width:200px" type="text" id="height"/> px</td>
  29. </tr>
  30. <tr>
  31. <td><span><var id="lang_input_isScroll"></var></span><input type="checkbox" id="scroll"/> </td>
  32. <td><span><var id="lang_input_frameborder"></var></span><input type="checkbox" id="frameborder"/> </td>
  33. </tr>
  34. <tr>
  35. <td colspan="2"><span><var id="lang_input_alignMode"></var></span>
  36. <select id="align">
  37. <option value=""></option>
  38. <option value="left"></option>
  39. <option value="right"></option>
  40. </select>
  41. </td>
  42. </tr>
  43. </table>
  44. </div>
  45. <script type="text/javascript">
  46. var iframe = editor._iframe;
  47. if(iframe){
  48. $G("url").value = iframe.getAttribute("src")||"";
  49. $G("width").value = iframe.getAttribute("width")||iframe.style.width.replace("px","")||"";
  50. $G("height").value = iframe.getAttribute("height") || iframe.style.height.replace("px","") ||"";
  51. $G("scroll").checked = (iframe.getAttribute("scrolling") == "yes") ? true : false;
  52. $G("frameborder").checked = (iframe.getAttribute("frameborder") == "1") ? true : false;
  53. $G("align").value = iframe.align ? iframe.align : "";
  54. }
  55. function queding(){
  56. var url = $G("url").value.replace(/^\s*|\s*$/ig,""),
  57. width = $G("width").value,
  58. height = $G("height").value,
  59. scroll = $G("scroll"),
  60. frameborder = $G("frameborder"),
  61. float = $G("align").value,
  62. newIframe = editor.document.createElement("iframe"),
  63. div;
  64. if(!url){
  65. alert(lang.enterAddress);
  66. return false;
  67. }
  68. newIframe.setAttribute("src",/http:\/\/|https:\/\//ig.test(url) ? url : "http://"+url);
  69. /^[1-9]+[.]?\d*$/g.test( width ) ? newIframe.setAttribute("width",width) : "";
  70. /^[1-9]+[.]?\d*$/g.test( height ) ? newIframe.setAttribute("height",height) : "";
  71. scroll.checked ? newIframe.setAttribute("scrolling","yes") : newIframe.setAttribute("scrolling","no");
  72. frameborder.checked ? newIframe.setAttribute("frameborder","1",0) : newIframe.setAttribute("frameborder","0",0);
  73. float ? newIframe.setAttribute("align",float) : newIframe.setAttribute("align","");
  74. if(iframe){
  75. iframe.parentNode.insertBefore(newIframe,iframe);
  76. domUtils.remove(iframe);
  77. }else{
  78. div = editor.document.createElement("div");
  79. div.appendChild(newIframe);
  80. editor.execCommand("inserthtml",div.innerHTML);
  81. }
  82. editor._iframe = null;
  83. dialog.close();
  84. }
  85. dialog.onok = queding;
  86. $G("url").onkeydown = function(evt){
  87. evt = evt || event;
  88. if(evt.keyCode == 13){
  89. queding();
  90. }
  91. };
  92. $focus($G( "url" ));
  93. </script>
  94. </body>
  95. </html>