《kiba自制文本编辑器》由会员分享,可在线阅读,更多相关《kiba自制文本编辑器(4页珍藏版)》请在金锄头文库上搜索。
1、*margin:0;padding:0;* html body overflow: visible;* html iframe, * html frame overflow: auto;* html frameset overflow: hidden;htmlmargin:0 auto; body div,body pmargin:0;padding:0; bodycolor:#575757; font:12px/22px Verdana,Arial,sans-serif,Times New Roman,;text-align:center; body,ul,ol,li,p,h1,h2,h3,
2、h4,h5,h6,form,fieldset,table,td,img,div,trmargin:0;padding:0; input,selectfont-size:12px;vertical-align:middle; body divtext-align:left; .bb .bb pmargin:0;padding:0; .biaoqian width:55px; background-color:#CDA29C; color:#F12563; border:1px solid #F12563; margin-left:5px; margin-top:5px; height:20px;
3、 line-height:20px; float:left; font-size:12px; cursor:pointer; text-align:centerkiba自制文本编辑器 function $(id)return document.getElementById(id); var is_IE=(navigator.appName=Microsoft Internet Explorer)?true:false; var iframe=null; function init() iframe=$(iframe); textarea=$(area); var html=; iframe.c
4、ontentWindow.document.open(); iframe.contentWindow.document.write(html); iframe.contentWindow.document.close(); if(is_IE) iframe.contentWindow.document.body.contentEditable=true; else iframe.contentWindow.document.designMode=on; run(); function run() insertHTML(*margin:0;padding:0;); function insert
5、HTML(html) if(is_IE) iframe.contentWindow.focus(); var orange=getSelected().createRange(); orange.pasteHTML(html); var tagfont = document.frames(0).document.all.tags(body); if (tagfont!=null) for(i=0; itagfont.length; i+) tagfonti.style.fontSize=12px; tagfonti.style.fontFamily=Arial; else document.e
6、xecCommand(insertHTML,html); var tagfont = document.frames(0).document.all.tags(body); if (tagfont!=null) for(i=0; itagfont.length; i+) tagfonti.style.fontSize=12px; tagfonti.style.fontFamily=Arial; function getSelected() return iframe.contentWindow.document.selection; function swapMode() if(iframe.
7、style.display=none) iframe.contentWindow.document.body.innerHTML=textarea.value; textarea.style.display=none iframe.style.display= document.getElementById(yuanma).innerHTML=编辑界面; else textarea.value=iframe.contentWindow.document.body.innerHTML; textarea.style.display= iframe.style.display=none docum
8、ent.getElementById(yuanma).innerHTML=显示源码; function MyFontSize() iframe.contentWindow.document.body.innerHTML=+iframe.contentWindow.document.body.innerHTML+; textarea.value=iframe.contentWindow.document.body.innerHTML; var tagfont = document.frames(0).document.all.tags(div); if (tagfont!=null) for(i=0; itagfont.length; i+) tagfonti.style.fontSize=24px; tagfonti.style.fontFamily=Arial; 显示源码 文字大小 上传图片