📄 editor.asp
字号:
}
var allequal=true;
var zi3a,zi3b;
var zthemax=0;
for(zi3=0;zi3<=zirowtot-1;zi3++){
zi3a=rowarray[0];
zi3b=rowarray[zi3];
if(zi3b>zthemax){zthemax=zi3b;}
if(zi3a!=zi3b){allequal=false;}
}
if(allequal==false){
var zi4=0;
var allequal2=true;
while(zthemax<=ypositequiv&&allequal==false){
for(zi5=0;zi5<=zirowtot-1;zi5++){
rowarray[zi5]+=parseInt(xsel.rows[zi5].cells[rowarray2[zi5]].colSpan);
}
for(zi3=0;zi3<=zirowtot-1;zi3++){
zi3a=rowarray[0];
zi3b=rowarray[zi3];
if(zi3b>zthemax){zthemax=zi3b;}
if(zi3a!=zi3b){allequal2=false;}
}
if(allequal2==true){allequal=true;}
for(zi8=0;zi8<=zirowtot-1;zi8++){rowarray2[zi8]++;}
}
}
var zi9;
for(zi7=0;zi7<=zirowtot-1;zi7++){
zi9=xsel.rows[zi7].insertCell(rowarray2[zi7]);
zi9.width=tempcellwidth;
}
}else if(command==4){
var temprowcount=xsel.rows.length;
for(iccount=0;iccount<=temprowcount-1;iccount++){
xsel.rows[iccount].deleteCell(cellindex);
}
}else if(command==1){
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==2){
var temprowcount=xsel.rows.length;tempcell=xsel.deleteRow(rowindex);
}else if(command==5){
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==6){
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==7){
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 tableProp(){
var tableflag=false;
HtmlEdit.focus();
var xsel=HtmlEdit.document.selection;
var xobj=HtmlEdit.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){
if(xsel.className!=""&&xsel.className!=null){tableclass=xsel.className;}else{tableclass="";}
if(xsel.width!=""&&xsel.width!=null){tablewidthspecified="yes";tablewidth=xsel.width;}else{tablewidthspecified="no";tablewith="";}
if(xsel.align!=""&&xsel.align!=null){tablealign=xsel.align;}else{tablealign="";}
if(xsel.border!=""&&xsel.border!=null){tablebordersize=xsel.border;}else{tablebordersize="";}
if(xsel.cellPadding!=""&&xsel.cellPadding!=null){tablecellpadding=xsel.cellPadding;}else{tablecellpadding="";}
if(xsel.cellSpacing!=""&&xsel.cellSpacing!=null){tablecellspacing=xsel.cellSpacing;}else{tablecellspacing="";}
if(xsel.borderColor!=""&&xsel.borderColor!=null){tablebordercolor=xsel.borderColor;}else{tablebordercolor="";}
if(xsel.bgColor!=""&&xsel.bgColor!=null){tablebackgroundcolor=xsel.bgColor;}else{tablebackgroundcolor="";}
tableiscancel="";
window.showModalDialog("editor_tableprops.asp",window," dialogWidth: 350px; dialogHeight: 300px; help: no;scroll: no; status: no");
if(tableiscancel=="no"){
if(tablewidthspecified=="yes"){
var tw1="";
if(tablewidthtype=="percentage"){
tw1=tablewidth+"%";
}else{
tw1=tablewidth;
}
xsel.width=tw1;
}else{
xsel.removeAttribute("width",0);
}
if(tablealign!=""&&tablealign!="Default"){xsel.align=tablealign;}else{xsel.removeAttribute("align",0);}
if(tableclass!=""&&tableclass!="Default"){xsel.className=tableclass;}else{xsel.removeAttribute("className",0);}
if(tablebordersize!=""&&tablebordersize!=null){xsel.border=tablebordersize;}else{xsel.removeAttribute("border",0);}
if(tablecellpadding!=""&&tablecellpadding!=null){xsel.cellPadding=tablecellpadding;}else{xsel.removeAttribute("cellPadding",0);}
if(tablecellspacing!=""&&tablecellspacing!=null){xsel.cellSpacing=tablecellspacing;}else{xsel.removeAttribute("cellSpacing",0);}
if(tablebordercolor!=""&&tablebordercolor!="Default"){xsel.borderColor=tablebordercolor;}else{xsel.removeAttribute("borderColor",0);}
if(tablebackgroundcolor!=""&&tablebackgroundcolor!="Default"){xsel.bgColor=tablebackgroundcolor;}else{xsel.removeAttribute("bgColor",0);}
}
}
}
function cellProp(){
var cellflag=false;
HtmlEdit.focus();
var xsel=HtmlEdit.document.selection;
var xobj=HtmlEdit.document.selection.createRange();
if(xsel.type=="None"||xsel.type=="Text"){
xsel=xobj.parentElement();
while(xsel.tagName!="BODY"&&cellflag==false){
if(xsel.tagName=="TD"){cellflag=true;}
if(cellflag==false){xsel=xsel.parentElement;}
}
}else if(xsel.type=="Control"){
xsel=xobj.item(0);
if(xsel.tagName=="TD"){
cellflag=true;
}else{
while(xsel.tagName!="BODY"&&cellflag==false){
if(xsel.tagName=="TD"){cellflag=true;}
if(cellflag==false){xsel=xsel.parentElement;}
}
}
}
if(cellflag==true){
if(xsel.width!=""&&xsel.width!=null){tablewidthspecified="yes";tablewidth=xsel.width;}else{tablewidthspecified="no";tablewith="";}
if(xsel.align!=""&&xsel.align!=null){tablealign=xsel.align;}else{tablealign="";}
if(xsel.className!=""&&xsel.className!=null){tablecellclass=xsel.className;}else{tablecellclass="";}
if(xsel.vAlign!=""&&xsel.vAlign!=null){tablevalign=xsel.vAlign;}else{tablevalign="";}
if(xsel.borderColor!=""&&xsel.borderColor!=null){tablebordercolor=xsel.borderColor;}else{tablebordercolor="";}
if(xsel.bgColor!=""&&xsel.bgColor!=null){tablebackgroundcolor=xsel.bgColor;}else{tablebackgroundcolor="";}
tableiscancel="";
window.showModalDialog("editor_cellprops.asp",window,"dialogWidth: 400px; dialogHeight: 230px;help: no;scroll: no; status: no");
if(tableiscancel=="no"){
if(tablewidthspecified=="yes"){
var tw1="";
if(tablewidthtype=="percentage"){tw1=tablewidth+"%";}else{tw1=tablewidth;}
xsel.width=tw1;
}else{
xsel.removeAttribute("width",0);
}
if(tablealign!=""&&tablealign!="Default"){xsel.align=tablealign;}else{xsel.removeAttribute("align",0);}
if(tablevalign!=""&&tablevalign!="Default"){xsel.vAlign=tablevalign;}else{xsel.removeAttribute("vAlign",0);}
if(tablecellclass!=""&&tablecellclass!="Default"){xsel.className=tablecellclass;}else{xsel.removeAttribute("className",0);}
if(tablebordercolor!=""&&tablebordercolor!="Default"){xsel.borderColor=tablebordercolor;}else{xsel.removeAttribute("borderColor",0);}
if(tablebackgroundcolor!=""&&tablebackgroundcolor!="Default"){xsel.bgColor=tablebackgroundcolor;}else{xsel.removeAttribute("bgColor",0);}
}
}
}
function table_ir()
{
tablecommand("ir");
}
function table_dr()
{
tablecommand("dr");
}
function table_ic()
{
tablecommand("ic");
}
function table_dc()
{
tablecommand("dc");
}
function table_mc()
{
tablecommand("mc");
}
function table_md()
{
tablecommand("md");
}
function table_sc()
{
tablecommand("sc");
}
function word()
{
HtmlEdit.document.execCommand("Paste",false);
var editBody=HtmlEdit.document.body;
for(var intLoop=0;intLoop<editBody.all.length;intLoop++){
el=editBody.all[intLoop];
el.removeAttribute("className","",0);
el.removeAttribute("style","",0);
el.removeAttribute("font","",0);
}
var html=HtmlEdit.document.body.innerHTML;
html=html.replace(/<o:p> <\/o:p>/g,"");
html=html.replace(/o:/g,"");
html=html.replace(/<font>/g, "");
html=html.replace(/<FONT>/g, "");
html=html.replace(/<span>/g, "");
html=html.replace(/<SPAN>/g, "");
html=html.replace(/<SPAN lang=EN-US>/g, "");
html=html.replace(/<P>/g, "");
html=html.replace(/<\/P>/g, "");
html=html.replace(/<\/SPAN>/g, "");
HtmlEdit.document.body.innerHTML = html;
format('selectall');
format('RemoveFormat');
}
function InsertChars(CharIndex)
{
if (! validateMode()) return;
HtmlEdit.focus();
var range =HtmlEdit.document.selection.createRange();
var Chars=new Array("<br>","©","®","™","•","…","—","–");
range.pasteHTML(Chars[CharIndex]);
HtmlEdit.focus();
}
function InsertEQ()
{
HtmlEdit.focus();
var range =HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_inserteq.asp", "", "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="<applet codebase='./' code='webeq3.ViewerControl' WIDTH=320 HEIGHT=100>"
str1=str1+"<PARAM NAME='parser' VALUE='mathml'><param name='color' value='"+b+"'><PARAM NAME='size' VALUE='18'>"
str1=str1+"<PARAM NAME=eq id=eq VALUE='"+a+"'></applet>"
range.pasteHTML(str1);
}
HtmlEdit.focus();
}
function InstallEQ()
{
window.open ("editor_inserteq.asp?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")
}
function calculator()
{
HtmlEdit.focus();
var range =HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_calculator.asp", "", "dialogWidth:205px; dialogHeight:210px; 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();
}
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -