⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 latticeeditor.js

📁 动感系统XP Access版,服务器需要安装Jmail 组件 配置SendMessages.asp 最后部分的参数
💻 JS
📖 第 1 页 / 共 5 页
字号:
			var temprowcount=xsel.rows.length;
			for(iccount=0;iccount<=temprowcount-1;iccount++){
				xsel.rows[iccount].deleteCell(cellindex);
			}
			}else if(command=="ir"){
				var tempcell;
				var tempcellb;
				var tempcellcount=xsel.rows[rowindex].cells.length;
				var cellcolarray=new Array(tempcellcount);
				var cellrowarray=new Array(tempcellcount);
				for(cacount=0;cacount<=tempcellcount-1;cacount++){
					cellcolarray[cacount]=xsel.rows[rowindex].cells(cacount).colSpan;
					cellrowarray[cacount]=xsel.rows[rowindex].cells(cacount).rowSpan;
				}
				tempcell=xsel.insertRow(rowindex);
				for(cbcount=0;cbcount<=tempcellcount-1;cbcount++){
					tempcellb=tempcell.insertCell();
					if(cellcolarray[cbcount]!=1){tempcellb.colSpan=cellcolarray[cbcount];}
				}
		}else if(command=="dr"){
				var temprowcount=xsel.rows.length;tempcell=xsel.deleteRow(rowindex);
		}else if(command=="mc"){
				if(xsel.rows[rowindex].cells[cellindex+1]){
					var x=parseInt(xsel.rows[rowindex].cells[cellindex].colSpan)+parseInt(xsel.rows[rowindex].cells[cellindex+1].colSpan);
					var y=xsel.rows[rowindex].cells[cellindex].innerHTML+" "+xsel.rows[rowindex].cells[cellindex+1].innerHTML;
					xsel.rows[rowindex].deleteCell(cellindex+1);
					xsel.rows[rowindex].cells[cellindex].colSpan=x;
					xsel.rows[rowindex].cells[cellindex].innerHTML=y;
				}
		}else if(command=="md"){
				var yatemprow=xsel.rows.length;
				var yamax=0;
				for(ya1=0;ya1<=yatemprow-1;ya1++){
					var ypositequiv=-1;
					var yposcount=0;
					var ymax=xsel.rows[ya1].cells.length;
					while(yposcount<=ymax-1){
						ypositequiv+=parseInt(xsel.rows[ya1].cells[yposcount].colSpan);
						yposcount++;
					}
					if(ypositequiv>yamax){yamax=ypositequiv;}
				}
				var rowarray=new Array();
				var rowarray2=new Array();
				var myrowcount=xsel.rows.length;
				for(ra1=0;ra1<=myrowcount-1;ra1++){
					rowarray[ra1]=new Array();
					rowarray2[ra1]=0;
					for(cr1=0;cr1<=yamax;cr1++){rowarray[ra1][cr1]=777;}
				}
				var tempra;
				var ra2=0;
				for(ra3=0;ra3<=yamax;ra3++){
					ra2=0;
					while(ra2<=myrowcount-1){
						if(xsel.rows[ra2].cells[ra3]){
							tempra=parseInt(xsel.rows[ra2].cells[ra3].rowSpan);
							if(tempra>1){
								rowarray[ra2][ra3]=ra3+rowarray2[ra2];
								for(zoo=1;zoo<=tempra-1;zoo++){rowarray2[ra2+zoo]--;}
							}
						}
						if(rowarray[ra2][ra3-1]!=ra3+rowarray2[ra2]){
							rowarray[ra2][ra3]=ra3+rowarray2[ra2];
						}else{
							rowarray[ra2][ra3]=555;
						}
						ra2++;
					}
				}
				var samx="";
				var samcount=0;
				for(rx1=0;rx1<=myrowcount-1;rx1++){
					samcount=rowarray[rx1].length;
					for(rx2=0;rx2<=samcount-1;rx2++){
						samx+="-"+rowarray[rx1][rx2];
					}
					samx+="\n";
				}
				var j=parseInt(xsel.rows[rowindex].cells[cellindex].rowSpan);
				var jcount=rowarray[rowindex].length;
				var jval=0;
				for(jc1=0;jc1<=jcount-1;jc1++){
					if(rowarray[rowindex][jc1]==cellindex){jval=jc1;}
				}
				if(xsel.rows[rowindex+j]){
					var cellindex2=rowarray[rowindex+j][jval];
					var x=parseInt(xsel.rows[rowindex].cells[cellindex].rowSpan)+parseInt(xsel.rows[rowindex+j].cells[cellindex2].rowSpan);
					var y=xsel.rows[rowindex].cells[cellindex].innerHTML+" "+xsel.rows[rowindex+j].cells[cellindex2].innerHTML;
					xsel.rows[rowindex+j].deleteCell(cellindex2);
					xsel.rows[rowindex].cells[cellindex].rowSpan=x;
					xsel.rows[rowindex].cells[cellindex].innerHTML=y;
				}
		}else if(command=="sc"){
				var getrowspan=parseInt(xsel.rows[rowindex].cells[cellindex].rowSpan);
				var getcolspan=parseInt(xsel.rows[rowindex].cells[cellindex].colSpan);
				if(getrowspan>1){
					var xr1=getrowspan-1;
					var xrposit=rowindex;
					var xrcposit=cellindex;
					var xrholder;xsel.rows[rowindex].cells[cellindex].rowSpan=1;
					for(xr2=1;xr2<=xr1;xr2++){
						xrholder=xsel.rows[xrposit+xr2].insertCell(xrcposit);
						xrholder.colSpan=xsel.rows[rowindex].cells[cellindex].colSpan;
					}
				}
				if(getcolspan>1){
					var yr1=getcolspan-1;
					var yrposit=rowindex;
					var yrcposit=cellindex;
					var yrholder;xsel.rows[rowindex].cells[cellindex].colSpan=1;
					for(yr2=1;yr2<=yr1;yr2++){
						yrholder=xsel.rows[yrposit].insertCell(yrcposit);
						yrholder.rowSpan=xsel.rows[rowindex].cells[cellindex].rowSpan;
					}
				}
			}
		}
}

function showcmenu(x,y){
	if(islattice=="lok"||keynotchecked==true){
		contextcode="";
		eval('window.showModalDialog("HtmlEditor/cmenu.htm",window,"dialogHeight: 310px;dialogLeft: '+x+'; dialogWidth: 150px; help: no;scroll: no; status: no")');
		if(contextcode=="1"){
			tableProp();
		}else if(contextcode=="2"){
			cellProp();
		}else if(contextcode=="3"){
			imageProp();
		}else if(contextcode=="20"){
			insertbookmark();
		}else if(contextcode=="4"){
			btncommand("btn_cut");
		}else if(contextcode=="5"){
			btncommand("btn_copy");
		}else if(contextcode=="6"){
			btncommand("btn_paste");
		}else if(contextcode=="31"){
			tablecommand("ic");
		}else if(contextcode=="32"){
			tablecommand("dc");
		}else if(contextcode=="33"){
			tablecommand("ir");
		}else if(contextcode=="34"){
			tablecommand("dr");
		}else if(contextcode=="35"){
			tablecommand("mc");
		}else if(contextcode=="36"){
			tablecommand("md");
		}else if(contextcode=="37"){
			tablecommand("sc");
		}else if(contextcode=="7"){
			//document.frames("LatticeTemp").focus();
			document.frames("LatticeTemp").document.execCommand("Refresh",false);
			document.frames("LatticeTemp").document.execCommand("Paste",false);
			var cc7=document.frames("LatticeTemp").document.body.innerText;
			//document.frames("LatticeEditDocument").focus();
			var xobj=document.frames("LatticeEditDocument").document.selection.createRange();
			xobj.pasteHTML(cc7);
		}else if(contextcode=="8"){
			//document.frames("LatticeTemp").focus();
			document.frames("LatticeTemp").document.execCommand("Refresh",false);
			document.frames("LatticeTemp").document.execCommand("Paste",false);
			var editBody=document.frames("LatticeTemp").document.body;
			for(var intLoop=0;intLoop<editBody.all.length;intLoop++){
				el=editBody.all[intLoop];
				el.removeAttribute("className","",0);
				el.removeAttribute("style","",0);
			}
			var html=document.frames("LatticeTemp").document.body.innerHTML;
			html=html.replace(/<o:p>&nbsp;<\/o:p>/g,"");
			html=html.replace(/o:/g,"");
			//document.frames("LatticeEditDocument").focus();
			var xobj=document.frames("LatticeEditDocument").document.selection.createRange();
			xobj.pasteHTML(html);
		}else if(contextcode=="9"){
			var tableflag=false;
			var xsel=document.frames("LatticeEditDocument").document.selection;
			var xobj=document.frames("LatticeEditDocument").document.selection.createRange();
			if(xsel.type=="None"||xsel.type=="Text"){
				xsel=xobj.parentElement();
				while(xsel.tagName!="BODY"&&tableflag==false){
					if(xsel.tagName=="TABLE"){tableflag=true;}
					if(tableflag==false){xsel=xsel.parentElement;}
				}
			}else if(xsel.type=="Control"){
				xsel=xobj.item(0);
				if(xsel.tagName=="TABLE"){
					tableflag=true;
				}else{
					while(xsel.tagName!="BODY"&&tableflag==false){
						if(xsel.tagName=="TABLE"){tableflag=true;}
						if(tableflag==false){xsel=xsel.parentElement;}
					}
				}
			}
			if(tableflag==true){
				xsel.removeAttribute("className","",0);
				xsel.removeAttribute("style","",0);
				var ccp=parseInt(xsel.border)+1;
				xsel.border=ccp;ccp=parseInt(xsel.border)-1;
				xsel.border=ccp;
			}
		}else{
		}
	}
}

function addimage(){
	if(imageisinserted==0){
		var insertimagetext="";
		insertimagetext='<IMG SRC="';
		insertimagetext+=imageurl;
		insertimagetext+='"';
		if(imagespecifysize=="yes"){
			insertimagetext+=' WIDTH="'+imagewidth+'"';
			insertimagetext+=' HEIGHT="'+imageheight+'"';
		}
		if(imagebordersize==""||imagebordersize=="0"){
			insertimagetext+=' BORDER="0"';
		}else{
			insertimagetext+=' BORDER="'+imagebordersize+'"';
		}
		if(imagealignment!="Default"){
			insertimagetext+=' ALIGN="'+imagealignment+'"';
		}
		if(imagehspacing==""||imagehspacing=="0"){
			insertimagetext+='';
		}else{
			insertimagetext+=' HSPACE="'+imagehspacing+'"';
		}
		if(imagevspacing==""||imagevspacing=="0"){
			insertimagetext+='';
		}else{
			insertimagetext+=' VSPACE="'+imagevspacing+'"';
		}
		insertimagetext+='>';
		var xman=frames ['LatticeEditDocument'].document.selection.createRange();
		var yman=frames ['LatticeEditDocument'].document.selection;
		var w=""+yman.type;
		var z=w.toUpperCase();
		if(z!="CONTROL"){
			xman.pasteHTML(insertimagetext);
		}else{
			yman.clear();
			xman=frames ['LatticeEditDocument'].document.selection.createRange();
			xman.pasteHTML(insertimagetext);
		}
		imageisinserted=1;
	}
}

function changebutton(btn,state){
	var currentstate=eval("state_"+btn);
	if(currentstate!=1){
		if((state==2&&currentstate==3)||(state==0&&currentstate==3)){
			if((btn=="btn_find"||btn=="btn_fontcolor"||btn=="btn_fonthilight")&&(eval("state_"+btn)!=2)){
				if(state=="0"){
					if(currentstate!=0){on(btn);}
				}
				if(state=="1"){
					if(currentstate!=1){off(btn);}
				}
				if(state=="2"){
					if(currentstate!=2){over(btn);}
				}
				if(state=="3"){
					if(currentstate!=3){down(btn);}
				}
				eval("state_"+btn+" = "+state);
			}
			var m=0;
		}else{
			if(state=="0"){
				if(currentstate!=0){on(btn);}
			}
			if(state=="1"){
				if(currentstate!=1){off(btn);}
			}
			if(state=="2"){
				if(currentstate!=2){over(btn);}
			}
			if(state=="3"){
				if(currentstate!=3){down(btn);}
			}
			eval("state_"+btn+" = "+state);
		}
	}
}

function btncommand(btn){
	islattice="lok";
	if(islattice=="lok"){
		if(btn=="btn_bold"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("Bold")==true){
				document.frames("LatticeEditDocument").document.execCommand("Bold",false);
			}
		}
		if(btn=="btn_italics"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("Italic")==true){
				document.frames("LatticeEditDocument").document.execCommand("Italic",false);
			}
		}
		if(btn=="btn_underline"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("Underline")==true){
				document.frames("LatticeEditDocument").document.execCommand("Underline",false);
			}
		}
		if(btn=="btn_left"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("JustifyLeft")==true){document.frames("LatticeEditDocument").document.execCommand("JustifyLeft",false);}
		}
		if(btn=="btn_center"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("JustifyCenter")==true){document.frames("LatticeEditDocument").document.execCommand("JustifyCenter",false);}
		}
		if(btn=="btn_right"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("JustifyRight")==true){document.frames("LatticeEditDocument").document.execCommand("JustifyRight",false);}
		}
		if(btn=="btn_numlist"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("InsertOrderedList")==true){
				if(state_numlist!=3){
					document.frames("LatticeEditDocument").document.execCommand("InsertOrderedList",false);
					state_numlist=3;
					changebutton("btn_numlist",3);
				}else{
					document.frames("LatticeEditDocument").document.execCommand("InsertOrderedList",false);
					state_numlist=0;
					changebutton("btn_numlist",0);
				}
			}
		}
		if(btn=="btn_bltlist"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("InsertUnorderedList")==true){
				if(state_numlist!=3){
					document.frames("LatticeEditDocument").document.execCommand("InsertUnorderedList",false);
					state_bltlist=3;
					changebutton("btn_bltlist",3);
				}else{
					document.frames("LatticeEditDocument").document.execCommand("InsertUnorderedList",false);
					state_bltlist=0;
					changebutton("btn_bltlist",0);
				}
			}
		}
		if(btn=="btn_outdent"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("Outdent")==true){
				document.frames("LatticeEditDocument").document.execCommand("Outdent",false);
			}
			state_btn_outdent=5;
			changebutton("btn_outdent",0);
		}
		if(btn=="btn_indent"){
			if(document.frames("LatticeEditDocument").document.queryCommandEnabled("Indent")==true){
				document.frames("LatticeEditDocument").document.execCommand("Indent",false);
				state_btn_indent=5;changebutton("btn_indent",0);
			}
		}
		if(btn=="btn_cut"){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -