insertframe.html 2.5 KB
<!doctypehtml><meta content="text/html; charset=utf-8"http-equiv=Content-Type><title></title><script src=../internal.js></script><style>.warp{width:320px;height:153px;margin-left:5px;padding:20px 0 0 15px;position:relative}#url{width:290px;margin-bottom:2px;margin-left:-6px}.format span{display:inline-block;width:58px;text-align:center;zoom:1}table td{padding:5px 0}#align{width:65px;height:23px;line-height:22px}</style><div class=warp><table cellpadding=0 cellspacing=0 width=300><tr><td colspan=2 class=format><span><var id=lang_input_address></var></span> <input id=url style=width:200px><tr><td colspan=2 class=format><span><var id=lang_input_width></var></span><input id=width style=width:200px> px<tr><td colspan=2 class=format><span><var id=lang_input_height></var></span><input id=height style=width:200px> px<tr><td><span><var id=lang_input_isScroll></var></span><input id=scroll type=checkbox><td><span><var id=lang_input_frameborder></var></span><input id=frameborder type=checkbox><tr><td colspan=2><span><var id=lang_input_alignMode></var></span> <select id=align><option value=""><option value=left><option value=right></select></table></div><script>var iframe=editor._iframe;function queding(){var e,t=$G("url").value.replace(/^\s*|\s*$/gi,""),r=$G("width").value,i=$G("height").value,a=$G("scroll"),l=$G("frameborder"),d=$G("align").value,n=editor.document.createElement("iframe");if(!t)return alert(lang.enterAddress),!1;n.setAttribute("src",/http:\/\/|https:\/\//gi.test(t)?t:"http://"+t),/^[1-9]+[.]?\d*$/g.test(r)&&n.setAttribute("width",r),/^[1-9]+[.]?\d*$/g.test(i)&&n.setAttribute("height",i),a.checked?n.setAttribute("scrolling","yes"):n.setAttribute("scrolling","no"),l.checked?n.setAttribute("frameborder","1",0):n.setAttribute("frameborder","0",0),d?n.setAttribute("align",d):n.setAttribute("align",""),iframe?(iframe.parentNode.insertBefore(n,iframe),domUtils.remove(iframe)):((e=editor.document.createElement("div")).appendChild(n),editor.execCommand("inserthtml",e.innerHTML)),editor._iframe=null,dialog.close()}iframe&&($G("url").value=iframe.getAttribute("src")||"",$G("width").value=iframe.getAttribute("width")||iframe.style.width.replace("px","")||"",$G("height").value=iframe.getAttribute("height")||iframe.style.height.replace("px","")||"",$G("scroll").checked="yes"==iframe.getAttribute("scrolling"),$G("frameborder").checked="1"==iframe.getAttribute("frameborder"),$G("align").value=iframe.align?iframe.align:""),dialog.onok=queding,$G("url").onkeydown=function(e){13==(e=e||event).keyCode&&queding()},$focus($G("url"))</script>