📄 html_edit.asp
字号:
DHTMLSafe.focus();
DHTMLSafe.DOM.body.focus();
}
function onImagewin(num)
{
DHTMLSafe=aeObjects[num];
DHTMLSafe.focus();
if (typeof(jk_edit_imgwin) == "undefined" || jk_edit_imgwin.closed)
{
var szURL;
szURL= "win_img.asp?<%response.write tmp_uppath%>";
jk_edit_imgwin = edit_open(szURL,"wim_img",400,235,"");
}
}
function onImage(oimg,num)
{
DHTMLSafe=aeObjects[num];
DHTMLSafe.DOM.selection.createRange().pasteHTML(oimg);
}
function jk_edit_onBeforeSave(aeObject)
{
for (var i=0;i<aeObject.DOM.images.length;i++)
{
hs=aeObject.DOM.images[i].getAttribute("STYLE",0).height;
ws=aeObject.DOM.images[i].getAttribute("STYLE",0).width;
if(hs.length)
{
aeObject.DOM.images[i].removeAttribute("HEIGHT", 0);
aeObject.DOM.images[i].setAttribute("HEIGHT", replaceString("px", "", hs),0);
aeObject.DOM.images[i].getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
}
if(ws.length)
{
aeObject.DOM.images[i].removeAttribute("WIDTH", 0);
aeObject.DOM.images[i].setAttribute("WIDTH", replaceString("px", "", ws),0);
aeObject.DOM.images[i].getAttribute("STYLE",0).removeAttribute("WIDTH",0);
}
}
for (var k=0;k<aeObject.DOM.all.tags("TABLE").length;k++)
{
hs=aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).height;
ws=aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).width;
if(hs.length)
{
aeObject.DOM.all.tags("TABLE").item(k).removeAttribute("HEIGHT", 0);
aeObject.DOM.all.tags("TABLE").item(k).setAttribute("HEIGHT", replaceString("px", "", hs),0);
aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
}
if(ws.length)
{
aeObject.DOM.all.tags("TABLE").item(k).removeAttribute("WIDTH", 0);
aeObject.DOM.all.tags("TABLE").item(k).setAttribute("WIDTH", replaceString("px", "", ws),0);
aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).removeAttribute("WIDTH",0);
}
}
var content = aeObject.DOM.body.innerHTML;
if(content.length) { content = aeObject.FilterSourceCode(content); }
replaceString("", " ", content);
return content;
}
function jk_edit_submit_form(obj, field)
{
var i;
for(i=1;i<=jk_edit_count;i++)
{
DHTMLSafe=aeObjects[i];
if (typeof(aeapi_local_onBeforeSave) == "function") { var jk_edit_content = aeapi_local_onBeforeSave(DHTMLSafe, aeFieldnames[num]); }
else if (typeof(aeapi_onBeforeSave) == "function") { var jk_edit_content = aeapi_onBeforeSave(DHTMLSafe, aeFieldnames[num]); }
else { var jk_edit_content = jk_edit_onBeforeSave(DHTMLSafe, aeFieldnames[num]); }
eval(obj).elements[element_idx].value = jk_edit_content;
}
eval(obj).submit();
}
function replaceString(oldS,newS,fullS)
{
for (var i=0; i<fullS.length; i++) { if (fullS.substring(i,i+oldS.length) == oldS) { fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length); } }
return fullS;
}
function jk_edit_about() { var wabour=edit_open("win_about.asp",window,400,223,"s"); }
function jk_edit_editsource(num)
{
DHTMLSafe=aeObjects[num];
DHTMLSafe.DOM.selection.empty();
codewin =edit_open("win_source.asp",window,500,500,"s");
}
function jk_edit_editsourceinline(num, bVal)
{
DHTMLSafe=aeObjects[num];
thisContentItem=eval("document.all.jk_word");
if(jk_edit_HTMLMode[num]==bVal) return;
DHTMLSafe.DOM.selection.empty();
if(jk_edit_HTMLMode[num])
{
document.normaltag.className="latched";
document.normaltag.type="";
document.htmltag.className="flat";
document.htmltag.type="btn";
if(jk_edit_defaultfont[num].length)
{ DHTMLSafe.DOM.body.style.font=jk_edit_defaultfont[num]; }
else
{
DHTMLSafe.DOM.body.style.fontFamily="宋体";
DHTMLSafe.DOM.body.style.fontSize="12px";
}
thisContentItem.value=DHTMLSafe.DOM.body.createTextRange().text;
DHTMLSafe.DOM.body.innerHTML = thisContentItem.value;
jk_edit_HTMLMode[num] = false;
}
else
{
var re=/((<br>)+)/ig;
document.normaltag.className="flat";
document.normaltag.type="btn";
document.htmltag.className="latched";
document.htmltag.type="";
DHTMLSafe.DOM.body.style.fontFamily = "宋体";
DHTMLSafe.DOM.body.style.fontSize = "12px";
thisContentItem.value=DHTMLSafe.DOM.body.innerHTML;
DHTMLSafe.DOM.body.innerHTML = "";
DHTMLSafe.DOM.body.createTextRange().text = thisContentItem.value.replace(re, "$1\n");
jk_edit_HTMLMode[num] = true;
}
}
function jk_edit_specialchars() { jk_edit_specialwin = edit_open("win_specialchars.asp",window,370,250,"s"); }
function jk_edit_quickfont(num)
{
if (jk_edit_HTMLMode[num]) { return; }
DHTMLSafe=aeObjects[num];
oSel=eval('document.all.oQuickFont'+num);
DHTMLSafe.ExecCommand(5044, 0, oSel.options[oSel.selectedIndex].name);
DHTMLSafe.focus();
DHTMLSafe.DOM.body.focus();
replaceFontsWithSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
condenseSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
}
function jk_edit_quickfontsize(num)
{
if (jk_edit_HTMLMode[num]) { return; }
DHTMLSafe=aeObjects[num];
oSel=eval('document.all.oQuickFontSize'+num);
DHTMLSafe.ExecCommand(5045, 0, oSel.options[oSel.selectedIndex].value);
DHTMLSafe.focus();
}
function jk_edit_quickformat(num)
{
if (jk_edit_HTMLMode[num]) { return; }
DHTMLSafe=aeObjects[num];
oSel=eval('document.all.oQuickFormat'+num);
DHTMLSafe.ExecCommand(5043, 0, oSel.options[oSel.selectedIndex].name);
DHTMLSafe.focus();
}
function jk_edit_hyperlinkwin(num)
{
jk_edit_hot=num;
DHTMLSafe=aeObjects[num];
DHTMLSafe.focus();
if(DHTMLSafe.DOM.selection.type=="Control")
{
var el=DHTMLSafe.DOM.selection.createRange().commonParentElement();
var tr = DHTMLSafe.DOM.body.createTextRange();
tr.moveToElementText(el);
tr.select();
}
if (typeof(jk_edit_linkwin) == "undefined" || jk_edit_linkwin.closed) { jk_edit_linkwin = edit_open("win_hyperlink.asp",window,400,230,"s"); }
}
function jk_edit_imageproperty(num, aWidth, aHeight, aBorder, aSrc, aAlt, aAlign)
{
DHTMLSafe=aeObjects[num];
var oSel=DHTMLSafe.DOM.selection.createRange().commonParentElement();
var tr = DHTMLSafe.DOM.body.createTextRange();
hs=oSel.getAttribute("STYLE",0).height;
ws=oSel.getAttribute("STYLE",0).width;
if (hs.length) { oSel.getAttribute("STYLE",0).removeAttribute("HEIGHT",0); }
if (ws.length) { oSel.getAttribute("STYLE",0).removeAttribute("WIDTH",0); }
oSel.width=aWidth;
oSel.height=aHeight;
oSel.border=aBorder;
oSel.src=aSrc;
oSel.alt=aAlt;
oSel.align=aAlign;
DHTMLSafe.focus();
DHTMLSafe.DOM.body.focus();
tr.moveToElementText(oSel);
tr.collapse(false);
tr.select();
}
function jk_edit_hyperlink(num, ivar, iHref, iTarget, iStyle, iClass, iName)
{
DHTMLSafe=aeObjects[num];
var uid="ae"+Math.random().toString();
if(iHref=="" && !iName.length)
{ if(DHTMLSafe.QueryStatus(5050)==3) { DHTMLSafe.ExecCommand(5050); } }
else
{
var trSel=DHTMLSafe.DOM.selection.createRange();
if(trSel.compareEndPoints("StartToEnd",trSel)==0)
{
txtHTML="<a href=\""+iHref+"\" ";
if(iTarget.length) { txtHTML+="target=\""+iTarget+"\" "; }
if(iStyle.length) { txtHTML+="style=\""+iStyle+"\" "; }
if(iClass.length) { txtHTML+="class=\""+iClass+"\" "; }
if(iName.length) { txtHTML+="name=\""+iName+"\" "; }
txtHTML+=">"+ivar+"</a>";
trSel.pasteHTML(txtHTML);
}
else
{
DHTMLSafe.ExecCommand(5016,2,uid);
var coll=DHTMLSafe.DOM.all.tags("A");
for(i=0;i<coll.length;i++)
{
if(coll[i].href==uid)
{
coll[i].href=iHref;
if(iTarget.length) coll[i].target=iTarget;
else coll[i].removeAttribute("TARGET",0);
if(iStyle.length) { coll[i].style.cssText=iStyle; }
else { coll[i].style.cssText=""; }
if(iClass.length) { coll[i].className=iClass; }
else { coll[i].className=""; }
}
}
}
}
DHTMLSafe.focus();
}
function ShowMenu(num)
{
var menuStrings = new Array();
var menuStates = new Array();
var state;
var i;
var idx = 0;
jk_edit_hot=num;
DHTMLSafe=aeObjects[num];
ContextMenu.length = 0;
if(alloweditsource[num]) { i=0; }
else { i=2; }
for (i=0;i<GeneralContextMenu.length; i++) { ContextMenu[idx++] = GeneralContextMenu[i]; }
if (DHTMLSafe.QueryStatus(5021) != 1) { for (i=0; i<TableContextMenu.length; i++) { ContextMenu[idx++] = TableContextMenu[i]; } }
var tr = DHTMLSafe.DOM.selection.createRange();
if (DHTMLSafe.DOM.selection.type == "Control") { for (i=0; i<ImageContextMenu.length; i++) { ContextMenu[idx++] = ImageContextMenu[i]; } }
for (i=0;i<AboutContextMenu.length; i++) { ContextMenu[idx++] = AboutContextMenu[i]; }
for (i=0; i<ContextMenu.length; i++)
{
menuStrings[i] = ContextMenu[i].string;
if ((menuStrings[i] != MENU_SEPARATOR) && (ContextMenu[i].cmdId < 6000)) { state = DHTMLSafe.QueryStatus(ContextMenu[i].cmdId); }
else { state = 3; }
if (state == 1 || state == 0) { menuStates[i] = 2; }
else if (state == 3 || state == 11) { menuStates[i] = 0; }
else { menuStates[i] = 1; }
if (ContextMenu[i].cmdId == 6004)
{
if (DHTMLSafe.ShowDetails) { menuStates[i] = 1; }
else { menuStates[i] = 0; }
}
if(ContextMenu[i].cmdId == 6001)
{
if(jk_edit_sourceview) { menuStates[i] = 1; }
else { menuStates[i] = 0; }
}
}
DHTMLSafe.SetContextMenu(menuStrings, menuStates);
}
function ContextMenuItem(string, cmdId)
{
this.string = string;
this.cmdId = cmdId;
}
function QueryStatusItem(command, element)
{
this.command = command;
this.element = element;
}
var MENU_SEPARATOR = "";
var ContextMenu = new Array();
var GeneralContextMenu = new Array();
var AboutContextMenu = new Array();
var TableContextMenu = new Array();
var ImageContextMenu = new Array();
var genId = 0;
var abId = 0;
var tblId = 0;
var imgId = 0;
GeneralContextMenu[genId++] = new ContextMenuItem("编辑源代码", 6001);
GeneralContextMenu[genId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
if (!is_ie4)
{
TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
TableContextMenu[tblId++] = new ContextMenuItem("表格属性", 6006);
}
TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
TableContextMenu[tblId++] = new ContextMenuItem("插入行", 5021);
TableContextMenu[tblId++] = new ContextMenuItem("删除行", 5007);
TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
TableContextMenu[tblId++] = new ContextMenuItem("插入列", 5020);
TableContextMenu[tblId++] = new ContextMenuItem("删除列", 5006);
TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
TableContextMenu[tblId++] = new ContextMenuItem("插入单元格", 5019);
TableContextMenu[tblId++] = new ContextMenuItem("删除单元格", 5005);
TableContextMenu[tblId++] = new ContextMenuItem("合并单元格", 5029);
TableContextMenu[tblId++] = new ContextMenuItem("拆分单元格", 5047);
ImageContextMenu[imgId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
ImageContextMenu[imgId++] = new ContextMenuItem("图片属性", 6009);
GeneralContextMenu[genId++] = new ContextMenuItem("剪切", 5003) ;
GeneralContextMenu[genId++] = new ContextMenuItem("拷贝", 5002) ;
GeneralContextMenu[genId++] = new ContextMenuItem("粘贴", 5032) ;
GeneralContextMenu[genId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
GeneralContextMenu[genId++] = new ContextMenuItem("查找", 5008);
GeneralContextMenu[genId++] = new ContextMenuItem("全部显示", 6004);
AboutContextMenu[abId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
AboutContextMenu[abId++] = new ContextMenuItem("关于编辑器", 6002);
function jk_edit_m_out(src)
{
if(src.state==0) return;
if(src.state==2) { src.className="latched"; return; }
if(src.type=="btn")
{
window.status="";
src.className="flat";
}
}
function jk_edit_m_over(src)
{
if(src.state==0) return;
if(src.state==2) return;
if(src.type=="btn")
{
window.status=src.alt;
src.className="outset";
}
}
function jk_edit_m_down(src)
{
if(src.state==0) return;
if(src.type=="btn") { src.className="inset"; }
}
function jk_edit_m_up(src)
{
if(src.state==0) return;
if(src.state==2) { src.className="latched"; return; }
if(src.type=="btn") { src.className="outset"; }
}
function set_tbstates(num)
{
var pbtn;
var cid;
var state;
DHTMLSafe=aeObjects[num];
jk_edit_tbar=eval("jk_edit_tbar"+num);
if(DHTMLSafe.QueryStatus(5002)!=DHTMLSafe.QueryStatus(5003)) return;
for(var i=0;i<jk_edit_tbar.all.length;i++)
{
pbtn= jk_edit_tbar.all(i);
cid=pbtn.cid;
if(cid < 6000 && cid!=5016 && cid!=5050)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -