📄 edit.js
字号:
function fortable()
{
var arr = showModalDialog("editor/table.htm", "", "dialogWidth:32em; dialogHeight:10em; status:0;help:0");
if (arr != null){
var ss;
ss=arr.split("*")
row=ss[0];
col=ss[1];
width=ss[2];
height=ss[3];
cellpadding=ss[4];
cellspacing=ss[5];
align=ss[6];
border=ss[7];
var string;
string="<table border="+border+" width="+width+" height="+height+" cellpadding="+cellpadding+" cellspacing="+cellspacing+" align="+align+">";
for(i=1;i<=row;i++){
string=string+"<tr>";
for(j=1;j<=col;j++){
string=string+"<td></td>";
}
string=string+"</tr>";
}
string=string+"</table>";
content=HtmlEditor.document.body.innerHTML;
content=content+string;
HtmlEditor.document.body.innerHTML=content;
}
else HtmlEditor.focus();
}
function swf()
{
var arr = showModalDialog("editor/flash.htm", "", "dialogWidth:32em; dialogHeight:10em; status:0;help:0");
if (arr != null){
var ss;
ss=arr.split("*")
path=ss[0];
row=ss[1];
col=ss[2];
var string;
if (path!="http://" && path!="")
{
string="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width="+row+" height="+col+"><param name=movie value="+path+"><param name=quality value=high><embed src="+path+" pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width="+row+" height="+col+"></embed></object>"
content=HtmlEditor.document.body.innerHTML;
content=content+string;
HtmlEditor.document.body.innerHTML=content;
}
else HtmlEditor.focus();
}
}
function wmv()
{
var arr = showModalDialog("editor/media.htm", "", "dialogWidth:31em; dialogHeight:12em; status:0;help:0");
if (arr != null){
var ss;
ss=arr.split("*")
path=ss[0];
row=ss[1];
col=ss[2];
var string;
if (path!="http://" && path!="")
{
string="<object classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' width="+row+" height="+col+"><param name=Filename value="+path+"><param name='BufferingTime' value='5'><param name='AutoSize' value='-1'><param name='AnimationAtStart' value='-1'><param name='AllowChangeDisplaySize' value='-1'><param name='ShowPositionControls' value='0'><param name='TransparentAtStart' value='1'><param name='ShowStatusBar' value='1'></object>"
content=HtmlEditor.document.body.innerHTML;
content=content+string;
HtmlEditor.document.body.innerHTML=content;
}
else HtmlEditor.focus();
}
}
function rm()
{
var arr = showModalDialog("editor/rm.htm", "", "dialogWidth:31em; dialogHeight:12em; status:0;help:0");
if (arr != null){
var ss;
ss=arr.split("*")
path=ss[0];
row=ss[1];
col=ss[2];
var string;
if (path!="http://" && path!="")
{
string="<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width="+row+" height="+col+"><param name='CONTROLS' value='ImageWindow'><param name='CONSOLE' value='Clip1'><param name='AUTOSTART' value='-1'><param name=src value="+path+"></object><br><object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width="+row+" height=60><param name='CONTROLS' value='ControlPanel,StatusBar'><param name='CONSOLE' value='Clip1'></object>"
content=HtmlEditor.document.body.innerHTML;
content=content+string;
HtmlEditor.document.body.innerHTML=content;
}
else HtmlEditor.focus();
}
}
function pic1()
{
var arr = showModalDialog("editor/pic.htm", "", "dialogWidth:32em; dialogHeight:12em; status:0;help:0");
if (arr != null){
var ss;
ss=arr.split("*")
a=ss[0];
b=ss[1];
c=ss[2];
d=ss[3];
e=ss[4];
var str1;
if (a!="http://" && a!="")
{
str1="<img src='"+a+"' alt='"+b+"'"
str1=str1+" style='"+c+"'"
str1=str1+" width='"+d+"' height='"+e+"'"
str1=str1+">"
content=HtmlEditor.document.body.innerHTML;
content=content+str1;
HtmlEditor.document.body.innerHTML=content;
}
else HtmlEditor.focus();
}
}
function FIELDSET()
{
var arr = showModalDialog("editor/fieldset.htm", "", "dialogWidth:16.5em; dialogHeight:13.5em; status:0;help:0");
if (arr != null){
var ss;
ss=arr.split("*")
a=ss[0];
b=ss[1];
c=ss[2];
d=ss[3];
var str1;
str1="<FIELDSET "
str1=str1+"align="+a+""
str1=str1+" style='"
if(c.value!='')str1=str1+"color:"+c+";"
if(d.value!='')str1=str1+"background-color:"+d+";"
str1=str1+"'><Legend"
str1=str1+" align="+b+""
str1=str1+">标题</Legend>内容</FIELDSET>"
content=HtmlEditor.document.body.innerHTML;
content=content+str1;
HtmlEditor.document.body.innerHTML=content;
}
else HtmlEditor.focus();
}
function iframe()
{
var arr = showModalDialog("editor/iframe.htm", "", "dialogWidth:26em; dialogHeight:12.5em; status:0;help:0");
if (arr != null){
var ss;
ss=arr.split("*")
a=ss[0];
b=ss[1];
c=ss[2];
d=ss[3];
e=ss[4];
var str1;
if (a!="http://" && a!="")
{
str1="<iframe src='"+a+"'"
str1+=" scrolling="+b+""
str1+=" frameborder="+c+""
if(d!='')str1+=" marginheight="+d
if(e!='')str1+=" marginwidth="+e
str1=str1+"></iframe>"
content=HtmlEditor.document.body.innerHTML;
content=content+str1;
HtmlEditor.document.body.innerHTML=content;
}
else HtmlEditor.focus();
}
}
function hr()
{
var arr = showModalDialog("editor/hr.htm", "", "dialogWidth:19em; dialogHeight:17em; status:0;help:0");
if (arr != null){
var ss;
ss=arr.split("*")
a=ss[0];
b=ss[1];
c=ss[2];
d=ss[3];
e=ss[4];
var str1;
if (b!="" && e!="")
{
str1="<hr"
str1=str1+" color='"+a+"'"
str1=str1+" size="+b+"'"
str1=str1+" "+c+""
str1=str1+" align="+d+""
str1=str1+" width="+e
str1=str1+">"
content=HtmlEditor.document.body.innerHTML;
content=content+str1;
HtmlEditor.document.body.innerHTML=content;
}
else HtmlEditor.focus();
}
}
function help()
{
var helpmess;
helpmess="---------------编辑器帮助---------------\r\n\r\n"+
"1.必须在视图方式下提交内容。\r\n\r\n"+
"2.如果要书写源代码,请选中查看\r\n\r\n"+
" HTML源代码书写。\r\n\r\n";
alert(helpmess);
}
//Function to format text in the text box
function FormatText(command, option){
frames.HtmlEditor.document.execCommand(command, true, option);
frames.HtmlEditor.focus();
}
function specialtype(Mark){
//if (!Error(idEdit)) return;
var sel,RangeType;
sel = frames.HtmlEditor.document.selection.createRange();
RangeType = frames.HtmlEditor.document.selection.type;
if (RangeType == "Text"&&Mark!="marquee2"&&Mark!="marquee"){
sel.pasteHTML("<" + Mark + ">" + sel.text + "</" + Mark + ">");
sel.select();
}
else
if (RangeType=="Text"&&Mark=="marquee2"||RangeType=="Text"&&Mark=="marquee")
{
var speed=prompt("请输入文字移动或飞行的速度(0-255): ","3");
if (!speed) return;
if (speed!=null) {
sel.pasteHTML("<marquee behavior=alternate scrollamount=" + speed + ">" + sel.text + "</marquee>");
}
sel.select();
}
frames.HtmlEditor.focus();
}
//Function to add image
function AddImage(){
imagePath = prompt('请输入图片地址', 'http://');
if ((imagePath != null) && (imagePath != "")){
frames.HtmlEditor.document.execCommand('InsertImage', false, imagePath);
frames.HtmlEditor.focus();
}
frames.HtmlEditor.focus();
}
function foreColor()
{
var arr = showModalDialog("editor/selcolor.htm", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
if (arr != null) FormatText('forecolor', arr);
else frames.HtmlEditor.focus();
}
function BackColor()
{
var arr = showModalDialog("editor/selcolor.htm", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
if (arr != null) FormatText('BackColor', arr);
else frames.HtmlEditor.focus();
}
//Function to clear form
function ResetForm(){
if (window.confirm('确认要清空对话框内容?')){
frames.HtmlEditor.document.body.innerHTML = '';
return true;
}
return false;
}
//Function to open pop up window
function openWin(theURL,winName,features) {
window.open(theURL,winName,features);
}
function setMode(newMode)
{
bTextMode = newMode;
var cont;
if (bTextMode) {
cleanHtml();
cleanHtml();
cont=HtmlEditor.document.body.innerHTML;
HtmlEditor.document.body.innerText=cont;
} else {
cont=HtmlEditor.document.body.innerText;
HtmlEditor.document.body.innerHTML=cont;
}
HtmlEditor.focus();
}
function cleanHtml()
{
var fonts = HtmlEditor.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;
}
}
function checkType(idEdit,url){
//if (!Error(idEdit)) return;
var afilename,bfilename,filetype;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -