您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->唐唐企业管理网站源码>>CodeTang-Controls/Editor/editor.htm>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:唐唐企业管理网站源码
当前文件:文件类型 TangCompany/CodeTang-Controls/Editor/editor.htm打开代码结构图
普通视图
		            
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xmlns="http://www.w3.org/1999/xhtml" > 3<head> 4 <title></title> 5 <script type="text/javascript" language="javascript"> 6 var ie=document.all; 7 function $(id){ 8 return document.getElementById(id); 9 } 10 function Show(id){ 11 $(id).style.display="block"; 12 } 13 function Hide(obj){ 14 obj.style.display="none"; 15 } 16 17 window.onload=function(){ 18 $("c").contentWindow.document.designMode = "On"; 19 var c = window.frames["c"]; 20 c.document.onclick = function(){ 21 HideAll(); 22 } 23 24 var d = $("c").contentWindow.document; 25 var s = "<body style='font:normal 12px arial;padding:4px 6px;'><div></div></body>" 26 d.open() 27 d.write(s) 28 d.close() 29 } 30 31 function divCover(){ 32 var objSelects=document.getElementsByTagName("select"); 33 for(var i=0;i<objSelects.length;i++){ 34 objSelects[i].style.visibility="hidden"; 35 } 36 var obj=document.getElementsByTagName("embed"); 37 for(var i=0;i<obj.length;i++){ 38 obj[i].style.visibility="hidden"; 39 } 40 var over=$("divOver"); 41 if(!over){ 42 over=document.createElement("div"); 43 } 44 over.id="divOver"; 45 var oS=over.style; 46 oS.left="0px"; 47 oS.top="0px"; 48 oS.position = "absolute"; 49 oS.zIndex = "1"; 50 var height=document.body.scrollHeight+20; 51 if((window.screen.availHeight-window.screenTop-24)>height){ 52 height= window.screen.availHeight-window.screenTop-24; 53 } 54 height=height+"px"; 55 var width=window.screen.availWidth; 56 if(ie) width=window.screen.availWidth-20; 57 width=width+"px"; 58 over.innerHTML = "<table width="+width+" height="+height+" style='background-color:black; filter: Alpha(Opacity=40);-moz-opacity:0.4;'></div>"; 59 document.body.appendChild(over); 60 } 61 function HidePop(divID){ 62 $(divID).style.display="none"; 63 hideOver(); 64 } 65 function hideOver(){ 66 var over=$("divOver"); 67 if(over){ 68 over.innerHTML=""; 69 } 70 var objSelects=document.getElementsByTagName("select"); 71 for(var i=0;i<objSelects.length;i++){ 72 objSelects[i].style.visibility="visible"; 73 } 74 var obj=document.getElementsByTagName("embed"); 75 for(var i=0;i<obj.length;i++){ 76 obj[i].style.visibility="visible"; 77 } 78 } 79 function Pop(id,width,height){ 80 divCover(); 81 var dialog=$(id); 82 var os=dialog.style; 83 os.position="absolute"; 84 os.top="10px"; 85 os.left=(document.body.offsetWidth/2-width/2)+"px"; 86 os.zIndex="100"; 87 os.display="block"; 88 } 89 90 function HideAll(){ 91 Hide($("divList")); 92 Hide($("fontFace")); 93 Hide($("divInOut")); 94 Hide($("fontSize")); 95 Hide($("dvForeColor")); 96 Hide($("divAlign")); 97 } 98 //格式 99 function format(type, para){ 100 var c = $("c").contentWindow; 101 c.focus(); 102 if(!para){ 103 if(ie){ 104 c.document.execCommand(type); 105 }else{ 106 c.document.execCommand(type,false,false); 107 } 108 }else{ 109 c.document.execCommand(type,false,para); 110 } 111 c.focus(); 112 } 113 function fontname(obj){ 114 format('fontname',obj.innerHTML); 115 obj.parentNode.style.display='none' 116 } 117 function fontsize(size,obj){ 118 format('fontsize',size); 119 obj.parentNode.style.display='none'; 120 } 121 function ShowList(id){ 122 HideAll(); 123 Show(id); 124 } 125 function BtnAddLink(){ 126 var c = $("c").contentWindow; 127 if(ie){ 128 var sText = c.document.selection.createRange(); 129 format("CreateLink"); 130 sText.parentElement().outerHTML=sText.parentElement().outerHTML.replace("<A","<A target=\"_blank\""); 131 } 132 else 133 Pop('divLink','300','160');return false; 134 } 135 function addLink(){ 136 var l=$("txtLink").value; 137 if(l!="" && l.length>1 && l!="http://"){ 138 format("CreateLink",l); 139 CloseLink(); 140 }else{ 141 $("linkTip").style.display="block"; 142 } 143 } 144 function CloseLink(){ 145 $("txtLink").value="http://"; 146 Hide($("linkTip")); 147 HidePop("divLink"); 148 } 149 function addImg(){ 150 var i=$("txtImg").value; 151 if(i!="" && i.length>1 && i!="http://"){ 152 $("c").contentWindow.document.body.innerHTML+="<img src="+i+" />"; 153 CloseImg(); 154 }else{ 155 $("imgTip").style.display="block"; 156 } 157 } 158 function AddFace(obj){ 159 160 var txtPath="MeFace/"+obj+".gif"; 161 $("c").contentWindow.document.body.innerHTML+="<img src="+txtPath+" />"; 162 Hide($("divFace")); 163 HidePop("divFace"); 164 } 165 function HideFace(){ 166 167 $("divFace").style.display="none"; 168 $("c").contentWindow.focus(); 169 170 } 171 function CloseImg(){ 172 $("txtLink").value=""; 173 Hide($("imgTip")); 174 HidePop("divImg"); 175 } 176 function LoadCode(code,type){ 177 var divid=Math.random()*1000000; 178 var txt="<div><div style='background:url(../../../../images/icon/icode.gif) no-repeat;text-indent:12px;font:bold 12px arial;'>"+ type +" 代码 &nbsp;<a href=\"javascript:Copycode('"+ divid +"')\">复制</a></div><div id=\""+ divid +"\" style='border:1pt solid #cccccc;word-wrap: break-word; word-break:normal;width:750px;'>"+ unescape(code) +"</div></div>"; 179 if(ie) 180 $("c").contentWindow.document.body.innerHTML+=txt; 181 else 182 $("c").contentWindow.document.body.textContent+=txt; 183