insertframe.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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?aea0c61c"></script>
  7. <link rel="stylesheet" href="../../themes/default/dialog.css?963f161c">
  8. <style type="text/css">
  9. .warp {
  10. width: 320px;
  11. height: 200px;
  12. margin-left: 5px;
  13. padding: 20px 0 0 15px;
  14. position: relative;
  15. }
  16. #url {
  17. width: 290px;
  18. margin-bottom: 2px;
  19. margin-left: -6px;
  20. margin-left: -2px \9;
  21. *margin-left: 0;
  22. _margin-left: 0;
  23. }
  24. .format span {
  25. display: inline-block;
  26. width: 58px;
  27. text-align: left;
  28. zoom: 1;
  29. }
  30. table td {
  31. padding: 5px 0;
  32. }
  33. #align {
  34. width: 65px;
  35. height: 23px;
  36. line-height: 22px;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <div class="warp">
  42. <table width="300" cellpadding="0" cellspacing="0">
  43. <tr>
  44. <td colspan="2" class="format">
  45. <span><var id="lang_input_address"></var></span>
  46. <input style="width:200px" id="url" type="text" value=""/>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td colspan="2" class="format"><span><var id="lang_input_width"></var></span><input style="width:200px"
  51. type="text" id="width"/>
  52. px
  53. </td>
  54. </tr>
  55. <tr>
  56. <td colspan="2" class="format"><span><var id="lang_input_height"></var></span><input style="width:200px"
  57. type="text"
  58. id="height"/> px
  59. </td>
  60. </tr>
  61. <tr>
  62. <td><span><var id="lang_input_isScroll"></var></span><input type="checkbox" id="scroll"/></td>
  63. <td><span><var id="lang_input_frameborder"></var></span><input type="checkbox" id="frameborder"/></td>
  64. </tr>
  65. <tr>
  66. <td colspan="2"><span><var id="lang_input_alignMode"></var></span>
  67. <select id="align">
  68. <option value=""></option>
  69. <option value="left"></option>
  70. <option value="right"></option>
  71. </select>
  72. </td>
  73. </tr>
  74. </table>
  75. </div>
  76. <script type="text/javascript">
  77. var iframe = editor._iframe;
  78. if (iframe) {
  79. $G("url").value = iframe.getAttribute("src") || "";
  80. $G("width").value = iframe.getAttribute("width") || iframe.style.width.replace("px", "") || "";
  81. $G("height").value = iframe.getAttribute("height") || iframe.style.height.replace("px", "") || "";
  82. $G("scroll").checked = (iframe.getAttribute("scrolling") == "yes") ? true : false;
  83. $G("frameborder").checked = (iframe.getAttribute("frameborder") == "1") ? true : false;
  84. $G("align").value = iframe.align ? iframe.align : "";
  85. }
  86. function queding() {
  87. var url = $G("url").value.replace(/^\s*|\s*$/ig, ""),
  88. width = $G("width").value,
  89. height = $G("height").value,
  90. scroll = $G("scroll"),
  91. frameborder = $G("frameborder"),
  92. float = $G("align").value,
  93. newIframe = editor.document.createElement("iframe"),
  94. div;
  95. if (!url) {
  96. alert(lang.enterAddress);
  97. return false;
  98. }
  99. newIframe.setAttribute("src", /http:\/\/|https:\/\//ig.test(url) ? url : "http://" + url);
  100. /^[1-9]+[.]?\d*$/g.test(width) ? newIframe.setAttribute("width", width) : "";
  101. /^[1-9]+[.]?\d*$/g.test(height) ? newIframe.setAttribute("height", height) : "";
  102. scroll.checked ? newIframe.setAttribute("scrolling", "yes") : newIframe.setAttribute("scrolling", "no");
  103. frameborder.checked ? newIframe.setAttribute("frameborder", "1", 0) : newIframe.setAttribute("frameborder", "0", 0);
  104. float ? newIframe.setAttribute("align", float) : newIframe.setAttribute("align", "");
  105. if (iframe) {
  106. iframe.parentNode.insertBefore(newIframe, iframe);
  107. domUtils.remove(iframe);
  108. } else {
  109. div = editor.document.createElement("div");
  110. div.appendChild(newIframe);
  111. editor.execCommand("inserthtml", div.innerHTML);
  112. }
  113. editor._iframe = null;
  114. dialog.close();
  115. }
  116. dialog.onok = queding;
  117. $G("url").onkeydown = function (evt) {
  118. evt = evt || event;
  119. if (evt.keyCode == 13) {
  120. queding();
  121. }
  122. };
  123. $focus($G("url"));
  124. </script>
  125. </body>
  126. </html>