📄 html_editor.asp
字号:
<%
'=========================================================
' 『动感在线』版权所有(C) Donggan.Net
' 您可以自由应用本程序于合法的个人或商业行为。
' 您必须保留版权信息。
'=========================================================
' Version:1.3
' Date: 2003-01-10
' Script Written by xubin
'=========================================================
' Copyright (C) 1999-2002 Donggan.Net. All rights reserved.
' Web: http://www.Donggan.net
' Email: webmaster@Donggan.net,webmaster@mail.Donggan.net
'=========================================================
%>
<!--#Include File="conn.asp" -->
<!--#Include File="procedure.asp" -->
<%
Call loaderror()
Call showwebdata()
%>
<HTML>
<title>『动感 HTML 编辑器』</title>
<HEAD>
<META content="text/html; charSet=gb2312" http-equiv=Content-Type><LINK
href="images/Html_EdiTor.css" rel=stylesheet type=text/css>
<SCRIPT language=javascript>
var targetdoc;
public_description = new ediTor;
Function ediTor()
{
this.get_contents = GetContents;
this.get_plaincontents = GetPlainContents;
this.put_contents = PutContents;
}
Function GetContents()
{
return target.document.body.innerHTML;
}
Function GetPlainContents()
{
return target.document.body.innerText;
}
Function PutContents(contents)
{
targetdoc.designMode = "On";
target.document.body.innerHTML = "<div id='cdiv'><p>" + contents + "</div>";
}
Function cleanHtml() {
var fonts = target.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 SetMode(newMode) {
bTextMode = newMode;
var cont;
If (bTextMode) {
cleanHtml();
cleanHtml();
cont=target.document.body.innerHTML;
target.document.body.innerText=cont;
} Else {
cont=target.document.body.innerText;
target.document.body.innerHTML=cont;
}
target.focus();
}
Function onFontName(value)
{
targetdoc.execCommAND('FontName', '', value);
target.focus();
}
Function onFontSize(value)
{
targetdoc.execCommAND('FontSize', '', value);
target.focus();
}
Function onColor(value)
{
targetdoc.execCommAND('Forecolor','',value);
target.focus();
}
Function onBKColor(value)
{
targetdoc.execCommAND('backcolor','',value);
target.focus();
}
Function onBold()
{
targetdoc.execCommAND('Bold');
target.focus();
}
Function onItalic()
{
targetdoc.execCommAND('Italic');
target.focus();
}
Function onUnderLine()
{
targetdoc.execCommAND('Underline');
target.focus();
}
Function onALeft()
{
targetdoc.execCommAND('JustIfyLeft');
target.focus();
}
Function onACenter()
{
targetdoc.execCommAND('JustIfyCenter');
target.focus();
}
Function onARight()
{
targetdoc.execCommAND('JustIfyRight');
target.focus();
}
Function onNList()
{
targetdoc.execCommAND('InsertOrderedList');
target.focus();
}
Function onBList()
{
targetdoc.execCommAND('InsertUnorderedList');
target.focus();
}
Function onOutDent()
{
targetdoc.execCommAND('Outdent');
target.focus();
}
Function onInDent()
{
targetdoc.execCommAND('Indent');
target.focus();
}
Function getElem(sTag,start)
{
While ((start != null) && (start.tagName != sTag)) start = start.parentElement;
return start;
}
Function onHyperLink()
{
var doA = getElem("A",targetdoc.selection.createRange().parentElement());
var str = prompt("输入连接地址 ( 例如: http://www.Donggan.net ):", doA ? doA.href : "http:\/\/");
If ((str != null) && (str != "http://"))
{
If (targetdoc.selection.type == "None")
{
var sel = targetdoc.selection.createRange();
sel.pasteHTML("<A HREF=\""+str+"\">"+str+"</A> ");
sel.select();
}
Else
{
targetdoc.execCommAND('CreateLink','',str);
}
}
Else target.focus();
}
Function onImage()
{
var doA = getElem("A",targetdoc.selection.createRange().parentElement());
var str = prompt("输入图象连接 ( 例如: http://www.Donggan.net/images/img.gIf ):", doA ? doA.href : "http:\/\/");
If ((str != null) && (str != "http://"))
{
If (targetdoc.selection.type == "None")
{
var sel = targetdoc.selection.createRange();
sel.pasteHTML("<img src=\""+str+"\">");
sel.select();
}
Else
{
targetdoc.execCommAND('InsertImage','',str);
}
}
Else target.focus();
}
</SCRIPT>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY>
<DIV class=BAR id=FormatToolbar1><SELECT class=GEN id=FontName
language=javascript onchange=onFontName(this[this.selectedIndex].value);
style="WIDTH: 135px" title=字体> <OPTION selected value="">字体</OPTION> <OPTION
value=宋体>宋体</OPTION> <OPTION value=黑体>黑体</OPTION> <OPTION
value=楷体_GB2312>楷体</OPTION> <OPTION value=仿宋_GB2312>仿宋</OPTION> <OPTION
value="MS Song">MS宋体</OPTION> <OPTION value="MS Hei">MS黑体</OPTION> <OPTION
value=MingLiU>MingLiU</OPTION> <OPTION value=Arial>Arial</OPTION> <OPTION
value="Arial Black">Arial Black</OPTION> <OPTION value="Arial Narrow">Arial
Narrow</OPTION> <OPTION value="Bradley HAND ITC">Bradley HAND ITC</OPTION>
<OPTION value="Brush Script MT">Brush Script MT</OPTION> <OPTION
value="Century Gothic">Century Gothic</OPTION> <OPTION
value="Comic Sans MS">Comic Sans MS</OPTION> <OPTION
value=Courier>Courier</OPTION> <OPTION value="Courier New">Courier
New</OPTION> <OPTION value="MS Sans SerIf">MS Sans SerIf</OPTION> <OPTION
value=Script>Script</OPTION> <OPTION value=System>System</OPTION> <OPTION
value="Times New Roman">Times New Roman</OPTION> <OPTION
value="Viner HAND ITC">Viner HAND ITC</OPTION> <OPTION
value=Verdana>Verdana</OPTION> <OPTION value="Wide Latin">Wide Latin</OPTION>
<OPTION value=Wingdings>Wingdings</OPTION></SELECT> <SELECT class=GEN
id=FontSize language=javascript
onchange=onFontSize(this[this.selectedIndex].value); style="WIDTH: 52px"
title=字号> <OPTION selected value="">字号</OPTION> <OPTION value=1>1</OPTION>
<OPTION value=2>2</OPTION> <OPTION value=3>3</OPTION> <OPTION
value=4>4</OPTION> <OPTION value=5>5</OPTION> <OPTION value=6>6</OPTION>
<OPTION value=7>7</OPTION></SELECT>
<DIV class=SEP></DIV>
<DIV class=BTN id=BTN_BOLD language=javascript onclick="return onBold()"
title=粗体><IMG class=ICO height=22 src="images/bold.gIf" width=23>
</DIV>
<DIV class=BTN id=BTN_ITALIC language=javascript onclick="return onItalic()"
title=斜体><IMG class=ICO height=22 src="images/italic.gIf" width=23>
</DIV>
<DIV class=BTN id=BTN_UNDERLINE language=javascript
onclick="return onUnderLine()" title=下划线><IMG class=ICO height=22
src="images/under.gIf" width=23> </DIV>
<DIV class=SEP></DIV><SELECT class=GEN id=ForeColor language=javascript
onchange=onColor(this[this.selectedIndex].value); style="WIDTH: 90px" title=字色>
<OPTION selected value="">字的颜色</OPTION> <OPTION
style="BACKGROUND-COLOR: red; COLOR: white" value=red>红色</OPTION> <OPTION
style="BACKGROUND-COLOR: blue; COLOR: white" value=blue>蓝色</OPTION> <OPTION
style="BACKGROUND-COLOR: green; COLOR: white" value=green>绿色</OPTION> <OPTION
style="BACKGROUND-COLOR: yellow; COLOR: black" value=yellow>黄色</OPTION>
<OPTION style="BACKGROUND-COLOR: pink; COLOR: black" value=pink>粉红</OPTION>
<OPTION style="BACKGROUND-COLOR: cyan; COLOR: black" value=cyan>天青</OPTION>
<OPTION style="BACKGROUND-COLOR: white; COLOR: black" value=white>白色</OPTION>
<OPTION style="BACKGROUND-COLOR: darkred; COLOR: white"
value=darkred>深红</OPTION> <OPTION
style="BACKGROUND-COLOR: darkblue; COLOR: white" value=darkblue>深蓝</OPTION>
<OPTION style="BACKGROUND-COLOR: darkgreen; COLOR: white"
value=darkgreen>深绿</OPTION> <OPTION
style="BACKGROUND-COLOR: gold; COLOR: black" value=gold>金色</OPTION> <OPTION
style="BACKGROUND-COLOR: darkcyan; COLOR: white" value=darkcyan>蓝绿</OPTION>
<OPTION style="BACKGROUND-COLOR: gray; COLOR: white" value=gray>浅灰</OPTION>
<OPTION style="BACKGROUND-COLOR: black; COLOR: white"
value=black>黑色</OPTION></SELECT> <SELECT class=GEN id=BkColor
language=javascript onchange=onBKColor(this[this.selectedIndex].value);
style="WIDTH: 90px" title=背景色> <OPTION selected value="">背景颜色<OPTION
style="BACKGROUND-COLOR: red; COLOR: white" value=red>红色</OPTION> <OPTION
style="BACKGROUND-COLOR: blue; COLOR: white" value=blue>蓝色</OPTION> <OPTION
style="BACKGROUND-COLOR: green; COLOR: white" value=green>绿色</OPTION> <OPTION
style="BACKGROUND-COLOR: yellow; COLOR: black" value=yellow>黄色</OPTION>
<OPTION style="BACKGROUND-COLOR: pink; COLOR: black" value=pink>粉红</OPTION>
<OPTION style="BACKGROUND-COLOR: cyan; COLOR: black" value=cyan>天青</OPTION>
<OPTION style="BACKGROUND-COLOR: white; COLOR: black" value=white>白色</OPTION>
<OPTION style="BACKGROUND-COLOR: darkred; COLOR: white"
value=darkred>深红</OPTION> <OPTION
style="BACKGROUND-COLOR: darkblue; COLOR: white" value=darkblue>深蓝</OPTION>
<OPTION style="BACKGROUND-COLOR: darkgreen; COLOR: white"
value=darkgreen>深绿</OPTION> <OPTION
style="BACKGROUND-COLOR: gold; COLOR: black" value=gold>金色</OPTION> <OPTION
style="BACKGROUND-COLOR: darkcyan; COLOR: white" value=darkcyan>蓝绿</OPTION>
<OPTION style="BACKGROUND-COLOR: gray; COLOR: white" value=gray>浅灰</OPTION>
<OPTION style="BACKGROUND-COLOR: black; COLOR: white"
value=black>黑色</OPTION></SELECT> </DIV>
<DIV class=BAR id=FormatToolbar2>
<DIV class=BTN id=BTN_ALEFT language=javascript onclick="return onALeft()"
title=左对齐 NAME="JustIfy"><IMG class=ICO height=22
src="images/aleft.gIf" width=23> </DIV>
<DIV class=BTN id=BTN_ACENTER language=javascript onclick="return onACenter()"
title=居中 NAME="JustIfy"><IMG class=ICO height=22
src="images/center.gIf" width=23> </DIV>
<DIV class=BTN id=BTN_ARIGHT language=javascript onclick="return onARight()"
title=右对齐 NAME="JustIfy"><IMG class=ICO height=22
src="images/aright.gIf" width=23> </DIV>
<DIV class=SEP></DIV>
<DIV class=BTN id=BTN_NLIST language=javascript onclick="return onNList()"
title=数字编号><IMG class=ICO height=22 src="images/nlist.gIf" width=23>
</DIV>
<DIV class=BTN id=BTN_BLIST language=javascript onclick="return onBList()"
title=项目符号><IMG class=ICO height=22 src="images/blist.gIf" width=23>
</DIV>
<DIV class=SEP></DIV>
<DIV class=BTN id=BTN_OUTDENT language=javascript onclick="return onOutDent()"
title=减小缩进><IMG class=ICO height=22 src="images/ileft.gIf" width=23>
</DIV>
<DIV class=BTN id=BTN_INDENT language=javascript onclick="return onInDent()"
title=增加缩进><IMG class=ICO height=22 src="images/iright.gIf" width=23>
</DIV>
<DIV class=SEP></DIV>
<DIV class=BTN id=BTN_HYPERLINK language=javascript
onclick="return onHyperLink()" title=插入超级链接><IMG class=ICO height=22
src="images/wlink.gIf" width=23> </DIV>
<DIV class=BTN id=BTN_IMAGE language=javascript onclick="return onImage()"
title=插入图片><IMG class=ICO height=22 src="images/img.gIf" width=23>
</DIV>
<DIV class=SEP></DIV>
<DIV class=GEN id=EDIT_MODE style="WIDTH: 120px" title="Edit Mode"><INPUT
language=javascript name=switchMode onclick=SetMode(switchMode.checked)
type=checkbox> 编辑HTML源文件 </DIV></DIV>
<DIV class=tbContentElement id=tbContentElement><IFRAME id=target marginWidth=4
scrolling=yes src="about:blank" style="HEIGHT: 100%; WIDTH: 100%">
</IFRAME><BR>
<SCRIPT>
targetdoc = document.frames.target.document;
targetdoc.designMode = "On";
</SCRIPT>
</DIV>
<SCRIPT language=Javascript src="images/Html_EdiTor.js">
</SCRIPT>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -