📄 edit.js
字号:
var IFrameObject,TempWin;
function window_onload() {
var CurObjTime,YY,MM,DD,CurrentDateStr;
CurObjTime = new Date();
YY = CurObjTime.getFullYear ();
MM = CurObjTime.getMonth () + 1;
DD = CurObjTime.getDate ();
CurrentDateStr = YY + "年" + MM + "月" + DD + "日";
// form2.SendDate.value = CurrentDateStr;
// contentframe.focus();
}
function SetEdit(myobject){
var ClipVal = "";
if (window.frames (myobject.name).document.designMode!="On")
{
window.frames (myobject.name).document.open ();
window.frames (myobject.name).document.write ("<body style='font-size:16px'>");
window.frames (myobject.name).document.close ();
window.frames (myobject.name).document.designMode="On";
}
IFrameObject = myobject;
}
function But_onmouseover(MyButObject) {
MyButObject.style.borderLeftColor = "buttonhighlight";
MyButObject.style.borderTopColor = "buttonhighlight";
MyButObject.style.borderBottomColor = "buttonshadow";
MyButObject.style.borderRightColor = "buttonshadow";
MyButObject.border = 1;
}
function But_onmouseout(MyButObject) {
MyButObject.border = 0;
}
function But_onmousedown(MyButObject) {
MyButObject.style.borderLeftColor = "black";
MyButObject.style.borderTopColor = "black";
MyButObject.style.borderBottomColor = "white";
MyButObject.style.borderRightColor = "white";
MyButObject.border = 1;
}
function But_onmouseup(MyButObject) {
But_onmouseover(MyButObject);
}
function SelFontType_onchange() {
var SelNum,TypeVal;
SelNum = SelFontType.selectedIndex;
TypeVal = SelFontType.options [SelNum].value;
window.frames (IFrameObject.name).document.execCommand ("FontName","",TypeVal);
}
function SelFontSize_onchange() {
var SelNum,SizeVal;
SelNum = SelFontSize.selectedIndex;
SizeVal = SelFontSize.options [SelNum].value;
window.frames (IFrameObject.name).document.execCommand ("fontsize","",SizeVal);
}
function SelFontColor_onchange() {
var SelNum,ColorVal;
SelNum = SelFontColor.selectedIndex;
ColorVal = SelFontColor.options [SelNum].value;
window.frames (IFrameObject.name).document.execCommand ("ForeColor","",ColorVal);
}
function SelBackColor_onchange() {
var SelNum,BgColorVal;
SelNum = SelBackColor.selectedIndex;
BgColorVal = SelBackColor.options [SelNum].value;
window.frames (IFrameObject.name).document.execCommand ("BackColor","",BgColorVal);
}
function EditFont(myVar){
var CommandString;
switch (myVar)
{
case 1:
CommandString = "Bold";
break;
case 2:
CommandString = "Italic";
break;
case 3:
CommandString = "Underline";
break;
case 4:
CommandString = "Cut";
break;
case 5:
CommandString = "Copy";
break;
case 6:
CommandString = "Paste";
break;
case 7:
CommandString = "JustifyLeft";
break;
case 8:
CommandString = "JustifyCenter";
break;
case 9:
CommandString = "JustifyRight";
break;
case 10:
CommandString = "InsertOrderedList";
break;
case 11:
CommandString = "InsertUnorderedList";
break;
case 12:
CommandString = "Outdent";
break;
case 13:
CommandString = "Indent";
break;
case 14:
CommandString = "Subscript";
break;
case 15:
CommandString = "Superscript";
break;
case 16:
CommandString = "Undo";
break;
case 17:
CommandString = "Redo";
break;
case 20:
CommandString = "Print";
break;
}
if (CommandString=="InsertOrderedList" || CommandString=="InsertUnorderedList" || CommandString=="Outdent" || CommandString=="Indent")
{
window.frames (IFrameObject.name).document.execCommand (CommandString);
window.frames (IFrameObject.name).focus();
}
else
{
window.frames (IFrameObject.name).document.execCommand (CommandString);
}
}
function InsertUrl(){
alert("程序正在开发之中。");
//TempWin = window.open ("addurl/UrlSearch.html","InsertUrl","top=200,left=200,height=300,width=480,toolbar=no,menubar=no,location=no,resizable=yes,status=no,titlebar=no");
}
function DelUrl(){
var MyRangeObject;
window.frames (IFrameObject.name).focus();
MyRangeObject = window.frames(IFrameObject.name).document.selection.createRange ();
if (window.frames(IFrameObject.name).document.selection.type=="Text")
{
window.frames (IFrameObject.name).document.execCommand ("Unlink");
}
else if (window.frames(IFrameObject.name).document.selection.type=="Control")
{
ImgObj = MyRangeObject.item(0);
window.frames (IFrameObject.name).document.execCommand ("Unlink");
ImgObj.outerHTML = ImgObj.outerHTML;
}
}
function FinishUrl(){
var UrlVal,MyRangeObject,NewPath,ImgObj;
UrlVal = document.form1.TranContral.value;
if (UrlVal!="")
{
window.frames (IFrameObject.name).focus();
MyRangeObject = window.frames(IFrameObject.name).document.selection.createRange ();
window.frames (IFrameObject.name).document.execCommand ("Unlink");
if (window.frames(IFrameObject.name).document.selection.type=="Text")
{
if (MyRangeObject.htmlText!="")
{
NewPath = "<a href='" + UrlVal + "' target='_blank'>" + MyRangeObject.htmlText + "</a>";
MyRangeObject.pasteHTML(NewPath);
}
}
else if (window.frames(IFrameObject.name).document.selection.type=="Control")
{
ImgObj = MyRangeObject.item(0);
NewPath = "<a href='" + UrlVal + "' target='_blank'>" + ImgObj.outerHTML + "</a>";
ImgObj.outerHTML = NewPath;
}
}
else
{
//alert ("编辑!!!");
}
}
function circle(AlignType){
var MyRangeObject,PicHtmlString,NewPath,ImgObj;
if (AlignType!="")
{
window.frames (IFrameObject.name).focus();
MyRangeObject = window.frames(IFrameObject.name).document.selection.createRange ();
if (window.frames(IFrameObject.name).document.selection.type=="Control")
{
ImgObj = MyRangeObject.item(0);
if (ImgObj.align!=AlignType)
ImgObj.align = AlignType;
else
ImgObj.align = ""
}
else
{
//alert ("编辑!!!");
}
}
else
{
//alert ("编辑!!!");
}
}
function DivSeg(){
alert("程序正在开发之中。");
/*
if (IFrameObject.name=="contentframe")
{
OutString = "<img lowsrc=imgs/divflag.gif>";
window.frames (IFrameObject.name).focus();
MyRangeObject = window.frames(IFrameObject.name).document.selection.createRange ();
if (window.frames(IFrameObject.name).document.selection.type!="Control")
{
MyRangeObject.pasteHTML(OutString);
}
}
*/
}
function InsertTable(){
var TableVal,MyRangeObject;
var row,col,widths,borders,bordercolor,TabArray,OutString,i,j;
TableVal = window.showModalDialog("addtable/InsertTable.htm", "", "dialogHeight: 120px; dialogWidth: 260px; dialogTop: 200px; dialogLeft: 200px; help: no; resizable: 1; status: 0");
if (TableVal != null)
{
TabArray = TableVal.split("|")
row = TabArray[0];
col = TabArray[1];
widths = TabArray[2];
borders = TabArray[3];
bordercolor = TabArray[4];
OutString = "<table cellSpacing=0 cellPadding=0 width=" + widths + "% border=" + borders + " borderColor=" + bordercolor + ">";
for (i=1;i<=row;i++)
{
OutString = OutString + "<tr>";
for (j=1;j<=col;j++)
{
OutString = OutString + "<td width=" + Math.floor(100/col) + "% valign=top></td>";
}
OutString = OutString + "</tr>";
}
OutString = OutString + "</table>";
window.frames (IFrameObject.name).focus();
MyRangeObject = window.frames(IFrameObject.name).document.selection.createRange ();
MyRangeObject.pasteHTML(OutString);
}
else
{
//alert ("编辑!!!");
}
}
function InsertImg(){
alert("程序正在开发之中。");
//TempWin = window.open ("addpic/InsertPic.htm","InsertImg","top=200,left=200,height=300,width=480,toolbar=no,menubar=no,location=no,resizable=yes,status=no,titlebar=no");
}
function InsertFin(){
var InputString,MyRangeObject,ImgString,OutString,TempArray,NewsMulString;
InputString = document.form1.TranContral.value;
if (InputString != null)
{
TempArray = InputString.split("^");
ImgString = TempArray[0];
NewsMulString = TempArray[1];
if (ImgString!=0)
{
OutString = ImgString;
window.frames (IFrameObject.name).focus();
MyRangeObject = window.frames(IFrameObject.name).document.selection.createRange ();
MyRangeObject.pasteHTML(OutString);
}
if (NewsMulString!="")
{
if (document.form2.NewsMulArray.value.indexOf(NewsMulString)==-1)
{
document.form2.NewsMulArray.value = document.form2.NewsMulArray.value + NewsMulString;
}
}
}
else
{
//alert ("编辑!!!");
}
}
function InsertMul(){
alert("程序正在开发之中。");
// TempWin = window.open ("addmul/InsertMul.htm","InsertMul", "top=200,left=200,height=300,width=480,toolbar=no,menubar=no,location=no,resizable=yes,status=no,titlebar=no");
}
function Form2Submit(){
// document.form2.abstract.value = window.frames("abstractframe").document.body.innerHTML;
document.form2.content.value = window.frames("contentframe").document.body.innerHTML;
document.form2.submit ();
}
function EditAbs(){
AttTable.style.display = "none";
AbsTable.style.display = "";
}
function EditAtt(){
AbsTable.style.display = "none";
AttTable.style.display = "";
}
function ViewText(){
var OutText;
OutText = window.frames(IFrameObject.name).document.body.innerHTML;
alert(OutText);
}
function RemoveHtmlTag(MyValue){
var Temp,StartPos,EndPos,KeekFin;
do{
StartPos = MyValue.indexOf("<");
EndPos = MyValue.indexOf(">");
if ((StartPos<=-1)||(EndPos<=-1))
{
break;
}
Temp = MyValue.substring(StartPos,EndPos+1);
MyValue = MyValue.replace(Temp,"");
}while((StartPos>-1)&&(EndPos>-1))
return MyValue;
}
function EditConCode(){
window.frames (IFrameObject.name).focus();
window.frames (IFrameObject.name).document.body.innerText = window.frames(IFrameObject.name).document.body.innerHTML;
form2.visualedit.style.backgroundColor = "white";
form2.viewcode.style.backgroundColor = "#C8D2EC";
form2.visualedit.disabled = false;
form2.viewcode.disabled = true;
window.frames (IFrameObject.name).focus();
}
function EditConVis(){
window.frames (IFrameObject.name).focus();
window.frames(IFrameObject.name).document.body.innerHTML = window.frames(IFrameObject.name).document.body.innerText;
form2.visualedit.style.backgroundColor = "#C8D2EC";
form2.viewcode.style.backgroundColor = "white";
form2.visualedit.disabled = true;
form2.viewcode.disabled = false;
window.frames (IFrameObject.name).focus();
}
function RemoveFormat(){
var ClearContent;
window.frames (IFrameObject.name).focus();
ClearContent = window.frames(IFrameObject.name).document.body.innerHTML;
window.frames(IFrameObject.name).document.body.innerText = RemoveHtmlTag(ClearContent);
window.frames (IFrameObject.name).focus();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -