<html> <head> <title>在线编辑器</title> <script> function ifmput(ifm){//向指定iframe输入以下格式的内容 ifm1=ifm.document; var ifmc="<html> <head> "; ifmc+="<meta http-equiv='Content-Type' content='text/html; charset=gb2312'> "; ifmc+="<title>未标题</title> "; ifmc+="<style type='text/css'> <!-- "; ifmc+="body,td,th {font-size:12px;line-height:200%;} "; ifmc+="body,form,input{margin:0px;zoom:1;} "; ifmc+="a:link {text-decoration: none;color: #0066dd;} "; ifmc+="a:visited {text-decoration: none;color: #3399ee;} "; ifmc+="a:hover {text-decoration: underline;color: #FF0000;} "; ifmc+="a:active {text-decoration: none;color: #990000;} "; ifmc+="--> </style> </head> <body> "; ifmc+="</body> </html> "; ifm1.write(ifmc); ifm1.close(); } </script> </head> <body> <center> <table style="background-color:menu; border:outset menu" cellpadding=0 cellspacing=0> <tr><td> <!--<div id="editor" contenteditable align="left" style="height:250; width:350; background-color:white;font-face:Arial; padding:2; border:inset powderblue; scrollbar-base-color:powderblue; overflow-auto;">--> <iframe name=editor src="null.htm" width=350 height=250 marginheight=0 marginwidth=0></iframe> </td> </tr></table> <input type="button" value="粗体" onclick='editor.focus();editor.document.execCommand("Bold"); '> <input type="button" value="斜体" onclick='editor.focus();editor.document.execCommand("Italic"); '> <input type="button" value="下划线" onclick='editor.focus();editor.document.execCommand("Underline");'> <input type=button value="黑体" onclick="editor.focus();editor.document.execCommand('FontName',false,'黑体')"> <input type=button value="9号字" onclick="editor.focus();editor.document.execCommand('FontSize',false,9)"> <input type=button value="红色字" onclick="editor.focus();editor.document.execCommand('ForeColor',false,'#ff0000')"> <br> <input type=button value="撤消" onclick="editor.focus();editor.document.execCommand('Undo');"> <input type=button value="重做" onclick="editor.focus();editor.document.execCommand('Redo');" id=button2 name=button2> <input type=button value="删除" onclick="editor.focus();editor.document.execCommand('Delete')"> <input type=button value="剪切" onclick="editor.focus();editor.document.execCommand('Cut')"> <input type=button value="拷贝" onclick="editor.focus();editor.document.execCommand('Copy')"> <input type=button value="粘贴" onclick="editor.focus();editor.document.execCommand('Paste')"> <br> <input type=button value="刷新" onclick="editor.focus();document.execCommand('refresh',false,0)"> <input type=button value="停止" onclick="editor.focus();document.execCommand('stop');"> <input type=button value="预览" onclick="var a=window.open('','editorview');ifmput(a);a.document.body.innerHTML=editor.document.body.innerHTML;return false;"> </center> <form name="form1"> <textarea name="mytext" cols="50" rows="10">333</textarea> <input type="button" value="取文本" onclick='form1.mytext.value=editor.document.body.innerHTML;'> <input type="button" value="设文本" onclick='editor.document.body.innerHTML=form1.mytext.value;'> </form> <script> ifmput(editor);editor.document.designMode='On'; //setInterval("form1.mytext.value=editor.document.body.innerHTML",500); </script> </body> </html> |
![]() |
上一篇: | 用Javascript调用webservice服务的成功案例 |
下一篇: | IE8 中网站后台编辑器eWebEditor不能插入图片解决办法 |