| |||||
"+sMenu); oPopDocument.close(); height+=2; if(lefter+width > document.body.clientWidth) lefter=lefter-width; oPopupMenu.show(lefter - leftoff - 2, topper - topoff + 22, width, height, document.body); return false; } // Ӓ???ҥ??ʽש?ዙ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ?༭Ʒɨփ ??ʽש??ʼ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ?ı䱠??Ǹ?߶ȍ function sizeChange(size){ if (!BrowserInfo.IsIE55OrMore){ alert("?˹?ĜШҪIE5.5?汾Ҕɏ?Ė??֣?"); return false; } for (var i=0; i "); event.cancelBubble = true; event.returnValue = false; sel.select(); sel.moveEnd("character", 1); sel.moveStart("character", 1); sel.collapse(false); return false; } // Ɓ?Ί¼? if (event.ctrlKey){ // Ctrl+B,I,U if ((key == "B")||(key == "I")||(key == "U")){ return false; } } } } //???????㊂??function onMouseUp(event,TemplateType){ } //Html ?ꇩ???? function UpdateToolbar(){ } function GetAllAncestors(){ var p = GetParentElement(); var a = []; while (p && (p.nodeType==1)&&(p.tagName.toLowerCase()!='body')) { a.push(p); p=p.parentNode; } a.push(HtmlEdit.document.body); return a; } function GetParentElement(){ var sel=GetSelection(); var range=CreateRange(sel); switch (sel.type) { case "Text": case "None": return range.parentElement(); case "Control": return range.item(0); default: return HtmlEdit.document.body; } } function GetSelection(){ return HtmlEdit.document.selection; } function CreateRange(sel){ return sel.createRange(); } function SelectNodeContents(Obj,pos){ var node=Obj.el; EditControl=node; for (var i=0;i "); text = text.replace(/\t/g," "); return text; } // ȡ?༭Ʒ?Ąڈݍ function getHTML(){ var html; if((sCurrMode=="EDIT")||(sCurrMode=="VIEW")){ html = HtmlEdit.document.body.innerHTML; }else{ html = HtmlEdit.document.body.innerText; } if (sCurrMode!="TEXT"){ if ((html.toLowerCase()==" ")||(html.toLowerCase()==" ")){ html = ""; } } return html; } // ɨփ?༭Ʒ?Ąڈݍ function setHTML(html){ ContentEdit.value = html; switch (sCurrMode){ case "CODE": setMode0.src="Editor/images/Editor.gif"; setMode1.src="Editor/images/html2.gif"; setMode2.src="Editor/images/browse.gif"; setMode3.src="Editor/images/Text.gif"; HtmlEdit.document.designMode="on"; HtmlEdit.document.open(); HtmlEdit.document.write(edithead); HtmlEdit.document.write(Resumeblank(html)); HtmlEdit.document.close(); HtmlEdit.document.body.innerText=Resumeblank(html); HtmlEdit.document.body.contentEditable="true"; CurrentMode=1; EditMode=false; SourceMode=true; PreviewMode=false; bEditMode=true; break; case "EDIT": setMode0.src="Editor/images/Editor2.gif"; setMode1.src="Editor/images/html.gif"; setMode2.src="Editor/images/browse.gif"; setMode3.src="Editor/images/Text.gif"; HtmlEdit.document.designMode="on"; HtmlEdit.document.open(); HtmlEdit.document.write(edithead); HtmlEdit.document.write(html); HtmlEdit.document.close(); doZoom(nCurrZoomSize); CurrentMode=0; EditMode=true; SourceMode=false; PreviewMode=false; bEditMode=true; break; case "TEXT": setMode0.src="Editor/images/Editor.gif"; setMode1.src="Editor/images/html.gif"; setMode2.src="Editor/images/browse.gif"; setMode3.src="Editor/images/Text2.gif"; HtmlEdit.document.designMode="on"; HtmlEdit.document.open(); HtmlEdit.document.write(edithead); HtmlEdit.document.write(Resumeblank(html)); HtmlEdit.document.body.innerText=html; HtmlEdit.document.body.contentEditable="true"; HtmlEdit.document.close(); CurrentMode=1 EditMode=false; SourceMode=true; PreviewMode=false; bEditMode=true; borderShown = "0"; break; case "VIEW": setMode0.src="Editor/images/Editor.gif"; setMode1.src="Editor/images/html.gif"; setMode2.src="Editor/images/browse2.gif"; setMode3.src="Editor/images/Text.gif"; cleanHtml(); CurrentMode=3; HtmlEdit.document.designMode="off"; HtmlEdit.document.open(); HtmlEdit.document.write(edithead); HtmlEdit.document.write(Resumeblank(html)); HtmlEdit.document.body.contentEditable="false"; HtmlEdit.document.close(); EditMode=false; SourceMode=false; PreviewMode=false; bEditMode=false; break; default: alert("?펳?Ί??"); break; } HtmlEdit.document.onkeydown = new Function("return onKeyDown(HtmlEdit.event);"); HtmlEdit.document.oncontextmenu=new Function("return showContextMenu(HtmlEdit.event);"); HtmlEdit.document.onmouseup = new Function('return onMouseUp(HtmlEdit.event,1);'); if (borderShown != "0" && EditMode) { borderShown = "0"; showBorders(); } initHistory(); HtmlEdit.focus(); } // ϔʾ?ؖ?????ի var borderShown = 0; function showBorders() { if (!document.all){ setTimeout("showBorders()",1000); return; } if (!validateMode()) return; var allForms = HtmlEdit.document.body.getElementsByTagName("FORM"); var allInputs = HtmlEdit.document.body.getElementsByTagName("INPUT"); var allTables = HtmlEdit.document.body.getElementsByTagName("TABLE"); var allLinks = HtmlEdit.document.body.getElementsByTagName("A"); // ? for (a=0; a < allForms.length; a++) { if (borderShown == "0") { allForms[a].runtimeStyle.border = "1px dotted #FF0000" } else { allForms[a].runtimeStyle.cssText = "" } } // Input Hidden? for (b=0; b < allInputs.length; b++) { if (borderShown == "0") { if (allInputs[b].type.toUpperCase() == "HIDDEN") { allInputs[b].runtimeStyle.border = "1px dashed #000000" allInputs[b].runtimeStyle.width = "15px" allInputs[b].runtimeStyle.height = "15px" allInputs[b].runtimeStyle.backgroundColor = "#FDADAD" allInputs[b].runtimeStyle.color = "#FDADAD" } } else { if (allInputs[b].type.toUpperCase() == "HIDDEN") allInputs[b].runtimeStyle.cssText = "" } } // ? for (i=0; i < allTables.length; i++) { if (borderShown == "0") { allTables[i].runtimeStyle.border = "1px dotted #BFBFBF" } else { allTables[i].runtimeStyle.cssText = "" } allRows = allTables[i].rows for (y=0; y < allRows.length; y++) { allCellsInRow = allRows[y].cells for (x=0; x < allCellsInRow.length; x++) { if (borderShown == "0") { allCellsInRow[x].runtimeStyle.border = "1px dotted #BFBFBF" } else { allCellsInRow[x].runtimeStyle.cssText = "" } } } } // ??ӠA for (a=0; a < allLinks.length; a++) { if (borderShown == "0") { if (allLinks[a].href.toUpperCase() == "") { allLinks[a].runtimeStyle.borderBottom = "1px dashed #000000" } } else { allLinks[a].runtimeStyle.cssText = "" } } if (borderShown == "0") { borderShown = "1" } else { borderShown = "0" } scrollUp() } // ???ؒ?æɏ?? function scrollUp() { HtmlEdit.scrollBy(0,0); } // ???摩֤ function save() { if (CurrentMode==0){ //?༭ƷǶȫƤ˻ҳʱʹӃςæբһ?䣨ǫ??form1?ijɏ??û?? parent.myform.Content.value=HtmlEdit.document.body.innerHTML; //????༭ƷʱʹӃςæբһ?䣨ǫ??form1?ijɏ??û?? // self.opener.form1.content.value+=HtmlEdit.document.body.innerHTML; } else if(CurrentMode==1){ //?༭ƷǶȫƤ˻ҳʱʹӃςæբһ?䣨ǫ??form1?ijɏ??û?? parent.myform.Content.value=HtmlEdit.document.body.innerText; //????༭ƷʱʹӃςæբһ?䣨ǫ??form1?ijɏ??û?? // self.opener.form1.content.value+=HtmlEdit.document.body.innerText; } else{ alert("Ԥ?״̬??Ĝ???棡ǫψ?ص??༭״̬???梩; } HtmlEdit.focus(); } // ?첢??ǰʇ???ģʽ function isModeView(){ if (sCurrMode=="VIEW"){ alert("Ԥ?ʱ??ԊЭɨփ?༭ǸĚȝ??"); return true; } return false; } // Ԛ??ǰ΄??λփ?别. function insertHTML(html) { HtmlEdit.focus(); if (isModeView()) return false; if (HtmlEdit.document.selection.type.toLowerCase() != "none"){ HtmlEdit.document.selection.clear() ; } if (sCurrMode!="EDIT"){ html=HTMLEncode(html); } HtmlEdit.document.selection.createRange().pasteHTML(html) ; } //Ђ?ӈ빦Ĝ //?别?? function Insergongneng(what){ if (! validateMode()) return; HtmlEdit.focus(); var range = HtmlEdit.document.selection.createRange(); var ran = HtmlEdit.document.selection.createRange("").text; switch(what){ case "input": range.pasteHTML(' '); break; case "textarea": range.pasteHTML(''); break; case "radio": range.pasteHTML(' '); break; case "checkbox": range.pasteHTML(' '); break; case "bottom": range.pasteHTML(''); break; } HtmlEdit.focus(); } // ?别ς??˵? function Insermenu(id){ HtmlEdit.focus(); if (! validateMode()) return; var range = HtmlEdit.document.selection.createRange(); var ran = HtmlEdit.document.selection.createRange("").text; var arr = showModalDialog("Editor/editor_insmenu.asp?ChannelID=1001&id="+id, "", "dialogWidth:285pt;dialogHeight:186pt;help:0;status:0"); if (arr != null){ range.pasteHTML(arr); } HtmlEdit.focus(); } // ?别̘ʢ?? function Insertlr(filename,wwid,whei,myid){ if (! validateMode()) return; HtmlEdit.focus(); var range = HtmlEdit.document.selection.createRange(); var arr = showModalDialog("Editor/"+filename+"?ChannelID=1001&id="+myid, window, "dialogWidth:"+wwid+"pt;dialogHeight:"+whei+"pt;help:0;status:0"); if (arr != null){ range.pasteHTML(arr); } HtmlEdit.focus(); } // ˵?Ųٗ? var nCurrZoomSize = 100; var aZoomSize = new Array(10, 25, 50, 75, 100, 150, 200, 500); // ϔʾ?Ȁ? function doZoom(size) { HtmlEdit.document.body.runtimeStyle.zoom = size + "%"; nCurrZoomSize = size; } // ͼƬʴД ɏς?㍊ function zIndex(action){ var objReference = null; var RangeType = HtmlEdit.document.selection.type; if (RangeType != "Control") return; var selectedRange = HtmlEdit.document.selection.createRange(); for (var i=0; i Ҕςʇ???Σ? | '+HTMLEncode(range.text)+' |
ҔςʇҽӃƬ?Σ? '+HTMLEncode(range.text)+' |
/g, ""); html=html.replace(/<\/P>/g, ""); html=html.replace(/<\/SPAN>/g, ""); HtmlEdit.document.body.innerHTML = html; format('selectall'); format('RemoveFormat'); break; case "calculator": // ?Ƌㆷ var arr = showModalDialog("Editor/editor_calculator.asp?ChannelID=1001", "", "dialogWidth:205px; dialogHeight:230px; status:0;help:0"); if (arr != null){ var ss; ss=arr.split("*") a=ss[0]; b=ss[1]; var str1; str1=""+a+"" range.pasteHTML(str1); } HtmlEdit.focus(); break; case "help": //? var arr = showModalDialog("Editor/editor_help.asp?ChannelID=1001", "", "dialogWidth:580px; dialogHeight:460px; help: no; scroll: no; status: no"); break; case "FIELDSET": // ?Ŀ? var arr = showModalDialog("Editor/editor_fieldset.asp?ChannelID=1001", "", "dialogWidth:25em; dialogHeight:12.5em; help: no; scroll: no; status: no"); if (arr != null){ range.pasteHTML(arr); } HtmlEdit.focus(); break; case "iframe": //Ě?ҳ var arr = showModalDialog("Editor/editor_insertiframe.asp?ChannelID=1001", "", "dialogWidth:30em; dialogHeight:12em; help: no; scroll: no; status: no"); if (arr != null){ range.pasteHTML(arr); } HtmlEdit.focus(); break; case "insermarquee": // ??ı? var arr = showModalDialog("Editor/editor_marquee.asp?ChannelID=1001", "", "dialogWidth:275pt;dialogHeight:100pt;help:0;status:0"); if (arr != null){ range.pasteHTML(arr); } HtmlEdit.focus(); break; case "inseremot": // ?别?퇩 var arr = showModalDialog("Editor/editor_emot.asp?ChannelID=1001", "", "dialogWidth:400px;dialogHeight:400px;help:0;status:0"); if (arr != null){ range.pasteHTML(arr); } HtmlEdit.focus(); break; case "calljsad": // ?别JS?ꇩ var arr = showModalDialog("Editor/editor_ad.asp?ChannelID=1001", "", "dialogWidth:200px;dialogHeight:200px;help:0;status:0"); if (arr != null){ range.pasteHTML(arr); } HtmlEdit.focus(); break; case "Label": // ?别?ꇩ var arr = showModalDialog("Editor/editor_tree.asp?ChannelID=1001", "", "dialogWidth:230pt;dialogHeight:500px;help:0;status:0"); if (arr != null){ range.pasteHTML(arr); } HtmlEdit.focus(); break; case "editLabel": // ?༭?ꇩ var oControl; var oSeletion; var sRangeType; var zzz=""; oSelection = HtmlEdit.document.selection.createRange(); sRangeType = HtmlEdit.document.selection.type; if (sRangeType == "Control") { if (oSelection.item(0).tagName == "IMG"){ oControl = oSelection.item(0); zzz= oControl.zzz; } var arr = showModalDialog("Editor/editor_label.asp?ChannelID=1001&Action=Modify&Title=О?ıꇩ&editLabel="+zzz+"", window, "dialogWidth:" + 800 + "px;dialogHeight:" + 600 + "px;help:no;scroll:yes;status:no"); if (arr != null){ oControl.zzz=arr } }else{ alert("??Ĝ??html?ԏ); } HtmlEdit.focus(); break; case "InsertEQ": // ??ʽ var arr = showModalDialog("Editor/editor_inserteq.asp?ChannelID=1001", "", "dialogWidth:40em; dialogHeight:20em; status:0;help:0"); if (arr != null){ var ss; ss=arr.split("*") a=ss[0]; b=ss[1]; var str1; str1=" " str1=str1+"" str1=str1+" " range.pasteHTML(str1); } HtmlEdit.focus(); break; case "InstallEQ": // ??װ??ʽ window.open ("Editor/editor_inserteq.asp?ChannelID=1001&Action=Install", "", "height=200, width=300,left="+(screen.AvailWidth-300)/2+",top="+(screen.AvailHeight-200)/2+", toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no") break; case "batchpic": //ź?ɏ??ͼƬ var arr = showModalDialog("Editor/editor_insertpic.asp?ChannelID=1001&ShowType=0", "", "dialogWidth:800px; dialogHeight:470px; help: no; scroll: yes; status: no"); if (arr != null){ var ss=arr.split("$$$"); range.pasteHTML(ss[0]); for(var i=1;i<=ss[1];i++){ if (ss[i+1]!="None"){ parent.AddItem(ss[i+1]); } } } HtmlEdit.focus(); break; case "pic": //ɏ??ͼƬ var arr = showModalDialog("Editor/editor_Modifypic.asp?ChannelID=1001&ShowType=0", window, "dialogWidth:" + 500 + "px;dialogHeight:" + 540 + "px;help:no;scroll:yes;status:no"); if (arr != null){ var ss=arr.split("$$$"); for(var i=1;i<=ss[0];i++){ if (ss[i]!=""){ parent.AddItem(ss[i]); } } } HtmlEdit.focus(); break; case "swf": //ɏ??swf var arr = showModalDialog("Editor/editor_insertflash.asp?ChannelID=1001&ShowType=0", "", "dialogWidth:530px; dialogHeight:400px; help: no; scroll: yes; status: no"); if (arr != null){ var ss=arr.split("$$$"); range.pasteHTML(ss[0]); if (ss[1]!="None"){ parent.AddItem(ss[1]); } } HtmlEdit.focus(); break; case "wmv": //ɏ?? wmv var arr = showModalDialog("Editor/editor_insertmedia.asp?ChannelID=1001&ShowType=0", "", "dialogWidth:530px; dialogHeight:500px; help: no; scroll: yes; status: no"); if (arr != null){ var ss=arr.split("$$$"); range.pasteHTML(ss[0]); if (ss[1]!="None"){ parent.AddItem(ss[1]); } } HtmlEdit.focus(); break; case "Attribute": //???༭ var arr = showModalDialog("Editor/editor_Attribute.asp?ChannelID=1001", window, "dialogWidth:" + 600 + "px;dialogHeight:" + 270 + "px;help:no;scroll:yes;status:no"); showBorders(); showBorders(); HtmlEdit.focus(); break; case "rm": //ɏ?? rm var arr = showModalDialog("Editor/editor_insertrm.asp?ChannelID=1001&ShowType=0", "", "dialogWidth:500px; dialogHeight:500px; help: no; scroll: yes; status: no"); if (arr != null){ var ss=arr.split("$$$"); range.pasteHTML(ss[0]); if (ss[1]!="None"){ parent.AddItem(ss[1]); } } HtmlEdit.focus(); break; case "fujian": //ɏ?????? var arr = showModalDialog("Editor/editor_insertfujian.asp?ChannelID=1001&ShowType=0", "", "dialogWidth:31em; dialogHeight:12em; help: no; scroll: no; status: no"); if (arr != null){ var ss=arr.split("$$$"); range.pasteHTML(ss[0]); if (ss[1]!="None"){ parent.AddItem(ss[1]); } } HtmlEdit.focus(); break; case "title": // ɨփ?ꌢ if (RangeType != "Text"){ alert("ǫψѡԱһ?Ύė֣?"); return; } parent.document.myform.Title.value=range.text; break; case "keyword" :// ɨփ?ؼ? if (RangeType != "Text"){ alert("ǫψѡԱһ?Ύė֣?"); } if (parent.document.myform.Keyword.value==""){ parent.document.myform.Keyword.value=range.text; } else{ parent.document.myform.Keyword.value+="|"+range.text; } break; case "ProductName": if (RangeType != "Text"){ alert("ǫψѡԱһ?Ύė֣?"); return; } parent.document.myform.ProductName.value=range.text; break; case "Intro": if (RangeType != "Text"){ alert("ǫψѡԱһ?Ύė֣?"); return; } parent.document.myform.Intro.value=range.text; break; case "ProductIntro": if (RangeType != "Text"){ alert("ǫψѡԱһ?Ύė֣?"); return; } parent.document.myform.ProductIntro.value=range.text; break; case "ReplaceLabel": var oControl; var oSeletion; var sRangeType; oSelection = HtmlEdit.document.selection.createRange(); sRangeType = HtmlEdit.document.selection.type; if (sRangeType == "Control") { oControl = oSelection.item(0); var arr = showModalDialog("Editor/editor_tree.asp?ChannelID=1001", "", "dialogWidth:230pt;dialogHeight:500px;help:0;status:0"); if (arr != null){ oControl.outerHTML=arr } }else{ alert("??Ĝ??html?ԏ); } HtmlEdit.focus(); break; case "CreateLink"://??ӗ半 var arr = showModalDialog("Editor/editor_CreateLink.asp?ChannelID=1001&LinkName="+range.text+"", window, "dialogWidth:450px; dialogHeight:450px; help: no; scroll: no; status: no"); if (arr != null){ insertHTML(arr); } HtmlEdit.focus(); break; case "pagetitle": //Ěȝҳ?ķ֒??ꇩ var arr=showModalDialog("Editor/editor_Pagetitle.asp?ChannelID=1001","","dialogWidth:400pt;dialogHeight:80px;help:0;status:0"); if(arr!=null){ range.pasteHTML(arr); parent.selectPaginationType(); } HtmlEdit.focus(); break; case "copypagetitle": if (RangeType != "Text"){ alert("ǫψѡԱһ?Ύė֣?"); return; }else{ range.text="[NextPage" + range.text + "]\n\n" + range.text + ""; parent.selectPaginationType(); } break; case "FilterCode": var arr=showModalDialog("Editor/editor_FilterCode.asp?ChannelID=1001","","dialogWidth:400pt;dialogHeight:340px;help:0;status:0"); if(arr!=null){ var ss=arr.split(","); var strhtml=HtmlEdit.document.body.innerHTML if (ss[0] == "true"){ strhtml = ScriptHtml(strhtml, "Iframe", 2,"") } if (ss[1] == "true"){ strhtml = ScriptHtml(strhtml, "Object", 2,"") } if (ss[2] == "true"){ strhtml = ScriptHtml(strhtml, "Script", 2,"") } if (ss[3] == "true"){ strhtml = ScriptHtml(strhtml, "Style", 2,"") } if (ss[4] == "true"){ strhtml = ScriptHtml(strhtml, "Div", 2,"") } if (ss[5] == "true"){ strhtml = ScriptHtml(strhtml, "Span", 2,"") } if (ss[6] == "true"){ strhtml = ScriptHtml(strhtml, "Table", 2,"") } if (ss[7] == "true"){ strhtml = ScriptHtml(strhtml, "Table", 3,"") strhtml = ScriptHtml(strhtml, "Tbody", 3,"") strhtml = ScriptHtml(strhtml, "Tr", 3,"") strhtml = ScriptHtml(strhtml, "Td", 3,"") strhtml = ScriptHtml(strhtml, "Th", 3,"") } if (ss[8] == "true"){ strhtml = ScriptHtml(strhtml, "IMG", 1,"") } if (ss[9] == "true"){ strhtml = ScriptHtml(strhtml, "Font", 3,"") } if (ss[10] == "true"){ strhtml = ScriptHtml(strhtml, "A", 3,"") } if (ss[11] == "true"){ strhtml = ScriptHtml(strhtml, "Font", 4,ss[12]) } HtmlEdit.document.designMode="pe"; HtmlEdit.document.open(); HtmlEdit.document.write(edithead); HtmlEdit.document.write(strhtml); HtmlEdit.document.close(); doZoom(nCurrZoomSize); CurrentMode=0; EditMode=true; SourceMode=false; PreviewMode=false; bEditMode=true; } break; default: alert("?펳?Ί??"); break; } range=null; } // ԝʱ?⾶һςͨӃДΊ̢ ?镒 function findstr(){ var arr = showModalDialog("Editor/editor_find.asp?ChannelID=1001", window, "dialogWidth:320px; dialogHeight:170px; help: no; scroll: no; status: no"); } // ?别΄?? ??ʽש?ዙ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////