📄 edithtml.js
字号:
document.writeln("<table width=100% height=100% cellpadding=2 cellspacing=0><tr><td align=left colspan=2>");
document.writeln("<img src=../images/Ubb/img.gif alt=\"插入图片\" align=absmiddle style=cursor:pointer onClick=insertimg()>");
document.writeln("<input id=\"html\" type=\"checkbox\" value=\"ON\" onclick=\"setMode(this.checked);\"> 显示为HTML");
//内容框
document.writeln("</td></tr><tr><td height=100% colspan=2 Align=center><iframe ID=HtmlEditor MARGINHEIGHT=0 MARGINWIDTH=0 width=99% height=100%></iframe></td></tr><tr><TD></TD><TD></TD></tr></table>");
var IframeID=frames["HtmlEditor"];
IframeID.document.open();
IframeID.document.close();
IframeID.document.body.contentEditable = "True";
IframeID.document.body.style.fontSize="12pt";
IframeID.document.body.style.color="#333333";
//生成对像
function FormatText(command,option){frames.HtmlEditor.focus();frames.HtmlEditor.document.execCommand(command,true,option);}
//插入表格
function insertimg(){
IframeID.focus();
var arr = showModalDialog("../images/Ubb/insertimg.htm", window, "dialogWidth:22em; dialogHeight:21em; status:0; help:0;scroll:no;");
if (arr){
IframeID.document.body.innerHTML+=arr;
}
IframeID.focus();
}
function setMode(newMode)
{
bTextMode = newMode;
var cont;
if (bTextMode) {
cleanHtml();
cont=IframeID.document.body.innerHTML;
IframeID.document.body.innerText=cont;
} else {
cont=IframeID.document.body.innerText;
IframeID.document.body.innerHTML=cont;
}
IframeID.focus();
}
function cleanHtml()
{
var fonts = IframeID.document.body.all.tags("FONT");
var curr;
for (var i = fonts.length - 1; i >= 0; i--) {
curr = fonts[i];
if (curr.style.backgroundColor == "#ffffff") curr.outerHTML = curr.innerHTML;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -