?? editor.asp
字號:
var range = HtmlEdit.document.selection.createRange();
if(range.text!=""){
alert("請不要選擇任何文本");
}
else{
range.text="\n\n[NextPage]\n\n";
parent.selectPaginationType()
}
}
function InsertTable()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_inserttable.asp", "", "dialogWidth:450px;dialogHeight:200px;help: no; scroll: no; status: no");
if (arr != null){
range.pasteHTML(arr);
}
HtmlEdit.focus();
}
function FIELDSET()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_fieldset.asp", "", "dialogWidth:25em; dialogHeight:12.5em; help: no; scroll: no; status: no");
if (arr != null){
range.pasteHTML(arr);
}
HtmlEdit.focus();
}
function iframe()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_insertiframe.asp", "", "dialogWidth:30em; dialogHeight:12em; help: no; scroll: no; status: no");
if (arr != null){
range.pasteHTML(arr);
}
HtmlEdit.focus();
}
function hr()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_inserthr.asp", "", "dialogWidth:30em; dialogHeight:12em; help: no; scroll: no; status: no");
if (arr != null){
range.pasteHTML(arr);
}
HtmlEdit.focus();
}
function pic()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_insertpic.asp", "", "dialogWidth:31em; dialogHeight:17em; help: no; scroll: no; status: no");
if (arr != null){
var ss=arr.split("$$$");
range.pasteHTML(ss[0]);
parent.myform.IncludePic.checked=true;
if (ss[1]!="None")
{
parent.AddItem(ss[1]);
}
}
HtmlEdit.focus();
}
function swf()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_insertflash.asp", "", "dialogWidth:31em; dialogHeight:12em; help: no; scroll: no; status: no");
if (arr != null){
var ss=arr.split("$$$");
range.pasteHTML(ss[0]);
parent.myform.IncludePic.checked=true;
if (ss[1]!="None")
{
parent.AddItem(ss[1]);
}
}
HtmlEdit.focus();
}
function wmv()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_insertmedia.asp", "", "dialogWidth:31em; dialogHeight:12em; help: no; scroll: no; status: no");
if (arr != null){
var ss=arr.split("$$$");
range.pasteHTML(ss[0]);
parent.myform.IncludePic.checked=true;
if (ss[1]!="None")
{
parent.AddItem(ss[1]);
}
}
HtmlEdit.focus();
}
function rm()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_insertrm.asp", "", "dialogWidth:31em; dialogHeight:12em; help: no; scroll: no; status: no");
if (arr != null){
var ss=arr.split("$$$");
range.pasteHTML(ss[0]);
parent.myform.IncludePic.checked=true;
if (ss[1]!="None")
{
parent.AddItem(ss[1]);
}
}
HtmlEdit.focus();
}
function excel()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range =HtmlEdit.document.selection.createRange();
var str1="<object classid='clsid:0002E510-0000-0000-C000-000000000046' id='Spreadsheet1' codebase='file:\\Bob\software\office2000\msowc.cab' width='100%' height='250'><param name='EnableAutoCalculate' value='-1'><param name='DisplayTitleBar' value='0'><param name='DisplayToolbar' value='-1'><param name='ViewableRange' value='1:65536'></object>";
range.pasteHTML(str1);
HtmlEdit.focus();
}
function nowdate()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range =HtmlEdit.document.selection.createRange();
var d = new Date();
var str1=d.getYear()+"年"+(d.getMonth() + 1)+"月"+d.getDate() +"日";
range.pasteHTML(str1);
HtmlEdit.focus();
}
function nowtime()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range =HtmlEdit.document.selection.createRange();
var d = new Date();
var str1=d.getHours() +":"+d.getMinutes()+":"+d.getSeconds();
range.pasteHTML(str1);
HtmlEdit.focus();
}
function findstr()
{
if (! validateMode()) return;
var arr = showModalDialog("editor_find.asp", window, "dialogWidth:320px; dialogHeight:170px; help: no; scroll: no; status: no");
}
function help()
{
var arr = showModalDialog("editor_help.asp", "", "dialogWidth:580px; dialogHeight:460px; help: no; scroll: no; status: no");
}
function tablecommand(command)
{
var cellflag=false;
var rowflag=false;
var tableflag=false;
var cellindex,rowindex,tableref;
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"){cellindex=xsel.cellIndex;cellflag=true;}
if(cellflag==false){xsel=xsel.parentElement;}
}
}else if(xsel.type=="Control"){
xsel=xobj.item(0);
if(xsel.tagName=="TD"){
cellindex=xsel.cellIndex;
cellflag=true;
}else{
while(xsel.tagName!="BODY"&&cellflag==false){
if(xsel.tagName=="TD"){cellindex=xsel.cellIndex;cellflag=true;}
if(cellflag==false){xsel=xsel.parentElement;}
}
}
}
if(cellflag==true){
xsel=HtmlEdit.document.selection;
xobj=HtmlEdit.document.selection.createRange();
if(xsel.type=="None"||xsel.type=="Text"){
xsel=xobj.parentElement();
while(xsel.tagName!="BODY"&&rowflag==false){
if(xsel.tagName=="TR"){
rowindex=xsel.rowIndex;
rowflag=true;
}
if(rowflag==false){xsel=xsel.parentElement;}
}
}else if(xsel.type=="Control"){
xsel=xobj.item(0);
if(xsel.tagName=="TR"){
rowindex=xsel.rowIndex;
rowflag=true;
}else{
while(xsel.tagName!="BODY"&&rowflag==false){
if(xsel.tagName=="TR"){
rowindex=xsel.rowIndex;
rowflag=true;
}
if(rowflag==false){
xsel=xsel.parentElement;
}
}
}
}
xsel=HtmlEdit.document.selection;
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(command==3){
var temprowcount=xsel.rows.length;
var tempcell;
var tempspancount=0;
var tempspanholder;
var tempcellwidth=xsel.rows[rowindex].cells[cellindex].width;
var xpositequiv=-1;
var xposcount=0;
while(xposcount<=cellindex){
xpositequiv+=parseInt(xsel.rows[rowindex].cells[xposcount].colSpan);
xposcount++;
}
var ypositequiv=-1;
var yposcount=0;
var ymax=xsel.rows[rowindex].cells.length;
while(yposcount<=ymax-1){
ypositequiv+=parseInt(xsel.rows[rowindex].cells[yposcount].colSpan);
yposcount++;
}
var idealinsert=xpositequiv+1;
var zi2=0;
var zirowtouse=0;
var zirowtot=xsel.rows.length;
var rowarray=new Array(zirowtot);
var rowarray2=new Array(zirowtot);
for(init1=0;init1<=zirowtot-1;init1++){
rowarray[init1]=0;
rowarray2[init1]=0;
}
for(zi1=0;zi1<=zirowtot-1;zi1++){
zi2=0;
while(zi2<idealinsert&&(rowarray[zi1]==null||rowarray[zi1]<idealinsert)){
rowarray[zi1]+=parseInt(xsel.rows[zi1].cells[zi2].colSpan);
rowarray2[zi1]++;
zi2++;
}
}
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];
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -