?? editor.asp
字號(hào):
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();
}
//新加入功能
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('<INPUT value='+ran+'>');
break;
case "textarea":
range.pasteHTML('<TEXTAREA>'+ran+'</TEXTAREA>');
break;
case "radio":
range.pasteHTML('<INPUT type=radio>');
break;
case "checkbox":
range.pasteHTML('<INPUT type=checkbox>');
break;
case "bottom":
range.pasteHTML('<BUTTON>'+ran+'</BUTTON>');
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_insmenu.htm?id="+id, "", "dialogWidth:450pt;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(filename+"?id="+myid, window, "dialogWidth:"+wwid+"pt;dialogHeight:"+whei+"pt;help:0;status:0");
if (arr != null){
range.pasteHTML(arr);
}
HtmlEdit.focus();
}
function Insercode()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var ran = HtmlEdit.document.selection.createRange("").text;
range.pasteHTML('<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed"><tr><td bgcolor=#FDFDDF style="WORD-WRAP: break-word"><font style="color: #990000;font-weight:bold">以下是代碼片段:</font><br>'+ran+'</td></tr></table>');
HtmlEdit.focus();
}
function Inserquote()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var ran = HtmlEdit.document.selection.createRange("").text;
range.pasteHTML('<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed"><tr><td bgcolor=#F3F3F3 style="WORD-WRAP: break-word"><font style="color: #990000;font-weight:bold">以下是引用片段:</font><br>'+ran+'</td></tr></table>');
HtmlEdit.focus();
}
function inseremot()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_emot.htm", "", "dialogWidth:230pt;dialogHeight:186pt;help:0;status:0");
if (arr != null){
range.pasteHTML(arr);
}
HtmlEdit.focus();
}
function insermarquee()
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var arr = showModalDialog("editor_marquee.htm", "", "dialogWidth:395pt;dialogHeight:150pt;help:0;status:0");
if (arr != null){
range.pasteHTML(arr);
}
HtmlEdit.focus();
}
// 插入特殊對(duì)象
function inserteshu(whatsp)
{
if (! validateMode()) return;
HtmlEdit.focus();
var range = HtmlEdit.document.selection.createRange();
var ran = HtmlEdit.document.selection.createRange("").text;
switch(whatsp)
{
case "big":
if (ran != null){
range.pasteHTML("<big>" + ran + "</big>");
}
break;
case "small":
if (ran != null){
range.pasteHTML("<small>" + ran + "</small>");
}
break;
}
HtmlEdit.focus();
}
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<selectedRange.length; i++){
objReference = selectedRange.item(i);
if (action=='forward'){
objReference.style.zIndex +=1;
}else{
objReference.style.zIndex -=1;
}
objReference.style.position='absolute';
}
HtmlEdit.content = false;
}
// 相對(duì)(absolute)或絕對(duì)位置(static)
function absolutePosition(){
var objReference = null;
var RangeType = HtmlEdit.document.selection.type;
if (RangeType != "Control") return;
var selectedRange = HtmlEdit.document.selection.createRange();
for (var i=0; i<selectedRange.length; i++){
objReference = selectedRange.item(i);
if (objReference.style.position != 'absolute') {
objReference.style.position='absolute';
}else{
objReference.style.position='static';
}
}
HtmlEdit.content = false;
}
// 新加入代碼結(jié)束
</script>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -