第一步:打开 News_Mdy.asp
找到:Function ReplaceRemoteUrl(sHTML, sSaveFilePath, sFileExt)
整个函数...替换成:
Function ReplaceRemoteUrl(sHTML, sSaveFilePath, sFileExt)
Dim s_Content
s_Content = sHTML
If IsObjInstalled("Microsoft.XMLHTTP") = False then
ReplaceRemoteUrl = s_Content
Exit Function
End If
Dim re, RemoteFile, RemoteFileurl,SaveFileName,SaveFileType,arrSaveFileNameS,arrSaveFileName,sSaveFilePaths
Set re = new RegExp
re.IgnoreCase = True
re.Global = True
re.Pattern = "((http|https|ftp|rtsp|mms):(\/\/|\\\\){1}((\w)+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})(\S*\/)((\S)+[.]{1}(" & sFileExt & ")))"
Set RemoteFile = re.Execute(s_Content)
For Each RemoteFileurl in RemoteFile
SaveFileType = Replace(Replace(RemoteFileurl,"/", "a"), ":", "a")
arrSaveFileName = Right(SaveFileType,12)
arrSaveFileName= Year(now) & month(now) & day(now) & hour(now) & minute(now) & Second(now) & "_" & arrSaveFileName
sSaveFilePaths=sSaveFilePath & "/"
SaveFileName = sSaveFilePaths & arrSaveFileName
SaveFileName=SaveRemoteFile(SaveFileName, RemoteFileurl)
s_Content = Replace(s_Content,RemoteFileurl,SaveFileName)
Next
ReplaceRemoteUrl = s_Content
End Function
再找到:Function SaveRemoteFile(s_LocalFileName,s_RemoteFileUrl)
整个函数替换成:
Function SaveRemoteFile(s_LocalFileName,s_RemoteFileUrl)
Dim Ads, Retrieval, GetRemoteData
On Error Resume Next
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", s_RemoteFileUrl, False, "", ""
.Send
GetRemoteData = .ResponseBody
End With
Set Retrieval = Nothing
Set Ads = Server.CreateObject("Adodb.Stream")
With Ads
.Type = 1
.Open
.Write GetRemoteData
.SaveToFile Server.MapPath(s_LocalFileName), 2
.Cancel()
.Close()
End With
Set Ads=nothing
SaveRemoteFile=s_LocalFileName
"加水印图片------------EditBy Minghao
if sImage_WaterMarkAdd then
if Not IsObjInstalled("Persits.Jpeg") then
Response.write "请先安装ASPJPEG组件!才能使用图片水印功能!"
Response.end
end if
Dim wmc,posX,posY
set wmc=new Minghao_WaterMarkClass
wmc.SourceImage=Server.MapPath(s_LocalFileName)
wmc.open()
if wmc.width>=sImage_MinWidth and wmc.height>=sImage_MinHeight then
"符合条件..开始加水印
select case sImage_DrawPosition
case 0
posX=sImage_DrawPosX
posY=sImage_DrawPosY
case 1
posX=wmc.width - sImage_DrawPosX - sImage_DrawWidth
posY=sImage_DrawPosY
case 2
posX=wmc.width - sImage_DrawPosX - sImage_DrawWidth
posY=wmc.height - sImage_DrawPosY - sImage_DrawHeight
case 3
posX=sImage_DrawPosX
posY=wmc.height - sImage_DrawPosY - sImage_DrawHeight
end select
if sImage_WaterMarkType="Image" then "图片水印
wmc.WaterMarkImage=Server.mappath(sImage_WaterMarkImage)
wmc.WaterMarkImageTransColor=sImage_WaterMarkTransColor
wmc.DrawImage posX,posY,sImage_WaterMarkOpacity
else
wmc.DrawText posX,posY
end if
SaveRemoteFile=GetShortFileName(s_LocalFileName) & ".jpg"
wmc.Save Server.Mappath(GetShortFileName(s_LocalFileName) & ".jpg")
end if
wmc.close()
set wmc=nothing
end if
if SaveRemoteFile<>s_LocalFileName then DeleteFile(Server.Mappath(s_LocalFileName))
End Function
"取得短文件名.比如 xxxx/xxx/xxx/yy.gif 取得结果是 yy
Function GetShortFileName(str)
dim arr1,s
arr1=split(str,".")
s=len(arr1(ubound(arr1)))+1
GetShortFileName=Left(str,len(str)-s)
End Function
(注意看上面,有一个 DeleteFile......函数.这是包含在我另一个fso的文件中的.大家能实现就自己实现,不能实现,就自己把函数复制到一个地方就行)
Function DeleteFile(fName)
Dim FSO,F
Set FSO=server.CreateObject(Def_FsoObjectStr)
if FSO.FileExists(fName) then
Set F=FSO.GetFile(fName)
F.Delete
Set F=Nothing
end if
Set FSO=Nothing
End Function
第二步:打开 Upload.asp
修改 Editor 的 Upload.asp 文件. (注意我的是最新版的编辑器.自己修改的.想下载到
http://77521.cn下载.)
在头部加入:
<!--#Include File="../../Include/Config.asp" -->
<!--#Include File="../../Include/Minghao_WaterMarkClass.asp" -->
然后..用DW全文查找替换..把 sFileExt 全部替换成 sFileExt2 (因为与config里面变量有冲突)
找到:Sub DoUpload_Class()
整个过程替换掉:
Sub DoUpload_Class()
"On Error Resume Next
Dim oUpload, oFile
" 建立上传对象
Set oUpload = New upfile_class
" 取得上传数据,限制最大上传
oUpload.GetData(nAllowSize*1024)
If oUpload.Err > 0 Then
Select Case oUpload.Err
Case 1
Call OutScript("parent.UploadError("请选择有效的上传文件!")")
Case 2
Call OutScript("parent.UploadError("你上传的文件总大小超出了最大限制(" & nAllowSize & "KB)!")")
End Select
Response.End
End If
Set oFile = oUpload.File("uploadfile")
sFileExt2 = LCase(oFile.FileExt)
Call CheckValidExt(sFileExt2)
sOriginalFileName = oFile.FileName
sSaveFileName = GetRndFileName(sFileExt2)
oFile.SaveToFile Server.Mappath(sUploadDir & sSaveFileName)
Set oFile = Nothing
Set oUpload = Nothing
"若符合条件加水印图片------------EditBy Minghao
if sImage_WaterMarkAdd and (sFileExt2="jpg" or sFileExt2="gif" or sFileExt2="bmp" or sFileExt2="png") then
if Not IsObjInstalled("Persits.Jpeg") then
Response.write "请先安装ASPJPEG组件!才能使用图片水印功能!"
Response.end
end if
Dim wmc,posX,posY,newFileName
set wmc=new Minghao_WaterMarkClass
wmc.SourceImage=Server.MapPath(sUploadDir & sSaveFileName)
wmc.open()
if wmc.width>=sImage_MinWidth and wmc.height>=sImage_MinHeight then
"符合条件..开始加水印
select case sImage_DrawPosition
case 0
posX=sImage_DrawPosX
posY=sImage_DrawPosY
case 1
posX=wmc.width - sImage_DrawPosX - sImage_DrawWidth
posY=sImage_DrawPosY
case 2
posX=wmc.width - sImage_DrawPosX - sImage_DrawWidth
posY=wmc.height - sImage_DrawPosY - sImage_DrawHeight
case 3
posX=sImage_DrawPosX
posY=wmc.height - sImage_DrawPosY - sImage_DrawHeight
end select
if sImage_WaterMarkType="Image" then "图片水印
wmc.WaterMarkImage=Server.mappath(sImage_WaterMarkImage)
wmc.WaterMarkImageTransColor=sImage_WaterMarkTransColor
wmc.DrawImage posX,posY,sImage_WaterMarkOpacity
else
wmc.DrawText posX,posY
end if
newFileName=GetShortFileName(sUploadDir & sSaveFileName) & ".jpg"
wmc.Save Server.Mappath(GetShortFileName(sUploadDir & sSaveFileName) & ".jpg")
end if
wmc.close()
set wmc=nothing
if newFileName<>(sUploadDir&sSaveFileName) then DeleteFile(Server.Mappath(sUploadDir & sSaveFileName))
end if
End Sub
Function DeleteFile(fName)
Dim FSO,F
Set FSO=server.CreateObject(Def_FsoObjectStr)
if FSO.FileExists(fName) then
Set F=FSO.GetFile(fName)
F.Delete
Set F=Nothing
end if
Set FSO=Nothing
End Function
"取得短文件名.比如 xxxx/xxx/xxx/yy.gif 取得结果是 yy
Function GetShortFileName(str)
dim arr1,s
arr1=split(str,".")
s=len(arr1(ubound(arr1)))+1
GetShortFileName=Left(str,len(str)-s)
End Function
然后最后一步:在 Include/下.新建 Minghao_WaterMarkClass.asp
<%
"////////////////////////////////////////////////////////
"// 图片加水印功能类库
"// 明皓 77521.cn 2006.4.15
"///////////////////////////////////////////////////////
Class Minghao_WaterMarkClass
Private Jpeg
Private JpegMark
Private StatFlag
Public SourceImage
Public WaterMarkImage
Public WaterMarkImageTransColor
Private Sub Class_Initialize
SourceImage=""
WaterMarkImage=""
StatFlag=-1
Set Jpeg = Server.CreateObject("Persits.Jpeg")
End Sub
Private Sub class_Terminate
On Error Resume Next
Jpeg.Close
Set Jpeg=nothing
End sub
"-----------属性区----------------------------------
Public Property Get Width()
Call StatCheck()
Width=Jpeg.Width
End Property
Public Property Let Width(byval val)
Call StatCheck()
Jpeg.Width=val
End Property
Public Property Get Height()
Call StatCheck()
Height=Jpeg.Height
End Property
Public Property Let Height(byval val)
Call StatCheck()
Jpeg.Height=val
End Property
Public Property Get originalWidth()
Call StatCheck()
Height=Jpeg.OriginalWidth
End Property
Public Property Get originalHeight()
Call StatCheck()
Height=Jpeg.OriginalHeight
End Property
"----------私函---------------------------------------------
Private Sub StatCheck()
if SourceImage="" then
Response.write "对不起,请先指定SourceImage属性!"
Response.end
end if
if StatFlag=-1 then
Response.write "对不起,请先使用object.Open()方法打开图像文件."
Response.end
end if
End Sub
"-----------公函--------------------------------------------
Public Sub Open()
StatFlag=0
Call StatCheck()
Jpeg.Open(SourceImage)
End Sub
Public Sub Close()
if StatFlag<>-1 then
Jpeg.Close
end if
End Sub
Public Function Save(byval str)
Jpeg.Save(str)
End Function
Public Function DrawImage(byval x,byval y,byval Op)
if SourceImage="" or WaterMarkImage="" then
response.write "请先指定SourceImage与WaterMarkImage的值!"
end if
Set JpegMark=Server.CreateObject("Persits.Jpeg")
JpegMark.Open(WaterMarkImage)
if WaterMarkImageTransColor=-1 then
Jpeg.Canvas.DrawImage x,y,JpegMark,Op
else
Jpeg.Canvas.DrawImage x,y,JpegMark,Op,WaterMarkImageTransColor
end if
"Jpeg.Save SourceImage
JpegMark.close
set JpegMark=nothing
End Function
Public Function DrawText(byval x,byval y)
Call StatCheck()
Jpeg.Canvas.Font.Color = sImage_WaterMarkFontColor
Jpeg.Canvas.Font.Family = sImage_WaterMarkFontFamily
Jpeg.Canvas.Font.Bold = sImage_WaterMarkFontBold
Jpeg.Canvas.Font.Size = sImage_WaterMarkFontSize
Jpeg.Canvas.Font.ShadowColor = sImage_WaterMarkFontShadow
Jpeg.Canvas.Font.ShadowXoffset = sImage_WaterMarkFontShadowXoffset
Jpeg.Canvas.Font.ShadowYoffset = sImage_WaterMarkFontShadowYoffset
Jpeg.Canvas.Font.Quality = sImage_WaterMarkFontQuality
Jpeg.Canvas.Print x,y,sImage_WaterMarkText
"Jpeg.Save SourceImage
End Function
End Class
%>
把这个文件,包含在前面 News_Mdy.asp 和 Upload.asp 里.就行了.
Upload.asp 里面要包含:
<!--#Include File="../../Include/Config.asp" -->
<!--#Include File="../../Include/Minghao_WaterMarkClass.asp" -->
============================================
到此完成了.
只生成符合条件的图片文件,对于小文件直接跳过.且保留原来的扩展名.
修改 Include/Config.asp 文件 (下面是我的,自己对应做修改吧.注意编码.)
<%
Response.Charset="utf-8"
"//////////////////////////////////////////////////////////
"主要配制信息
"//////////////////////////////////////////////////////////
"FileSystemObject对象名称
Const Def_FsoObjectStr="Scripting.FileSystemObject"
"文件创建将使用的扩展名
Const Def_FileExtension=".html"
"系统主目录地址,结尾请不要加“/”
Const Def_TsysRootPath = ""
"添加资源时是否保存远程图片
Const sSaveFileSelect=True
"远程图片保存目录,结尾请不要加“/”
Const sSaveFilePath="/UpLoadFiles/NewsPhoto"
"远程图片保存类型
Const sFileExt="jpg|gif|bmp|png"
"--远程或上传图片保存时是否使用水印功能 "############### 这是水印相关
Const sImage_WaterMarkAdd=True
"--使用水印的图片最小高度及宽度 "############### 这是水印相关
Const sImage_MinWidth=200
Const sImage_MinHeight=150
"--使用图片水印还是文字水印 "############### 这是水印相关
Const sImage_WaterMarkType="Image" " Image or Text "Image是用图片水印
"--水印图片地址 "############### 这是水印相关
Const sImage_WaterMarkImage="/WaterMark.gif"
Const sImage_WaterMarkOpacity=1 "水印图片的透明度,取值 0 - 1 之间. 越小越透明.
Const sImage_WaterMarkTransColor=-1 "水印图片的透明色,取值为&Hxxxxxx 比如红色 &Hff0000 若是黑色,也就是说水印图的所有黑色会被设置为透明,
"--水印文字内容 "############### 这是水印相关
Const sImage_WaterMarkText="CopyRight(C) 77521.cn" "文字内容
Const sImage_WaterMarkFontFamily="宋体" "字体
Const sImage_WaterMarkFontSize=14 "文字大小
Const sImage_WaterMarkFontColor=&H000000 "取值为&Hxxxxxx 比如红色 &Hff0000
Const sImage_WaterMarkFontBold=True "是否粗体
Const sImage_WaterMarkFontShadow=&HFFFFFF "水印文字的阴影颜色
Const sImage_WaterMarkFontShadowXoffset=1 "水印文字阴影向右偏移的像素值,输入负值则向左偏移
Const sImage_WaterMarkFontShadowYoffset=1 "水印文字阴影向下偏移的像素值,输入负值则向上偏移
Const sImage_WaterMarkFontQuality=4 "水印文字的清晰度,从0~4
"--水印坐标 "############### 这是水印相关
Const sImage_DrawPosition=2 "0=左上角 1=右上角 2=右下角 3=左下角 --下面的x,y都是相对的偏移,比如现在就是距右下角10,10的地方
Const sImage_DrawPosX=10
Const sImage_DrawPosY=10
"--水印尺寸(图片大小或文字的大小,这个请自行用PS或其它工具取得) "############### 这是水印相关
Const sImage_DrawWidth=74
Const sImage_DrawHeight=13
"一个管理员帐户是否允许同时多个不同IP使用
Const Def_DubleOnlineUser=False
"后台资源列表的每页显示数目
Const Def_Sys_PageSize=20
"栏目列表的每页显示数目
Const CreateNewsList_PageSize=20
"生成的栏目资源列表每页显示数目
Const NewsList_PageSize=20
"生成资源时允许的服务器脚本超时时间
Const Def_CreateNewsFiles_ScriptTimeOut=900
"生成资源中当路径不存在时是否提示
Const Def_CreateNewsFiles_ShowFolderError=True
"资源系统允许的关键词数目
Const Def_NewsKeyWordListNum=10
"生成的相关资源数目
Const Def_RelateNewsNumber=10
"在生成资源时是否使用模板缓冲(将提高生成速度及稳定性;同时会牺牲小部分内存,依据模板内容大小而定;)
Const Def_Buffer_WhenCreatingFile=True
Const Def_Buffer_WhenCreatingFile_DiyTemplate=True
"默认评论管理页显示大小
Const Def_Comment_PageSize=30
"//////////////////////////////////////////////////////////
"其它配制信息
"//////////////////////////////////////////////////////////
"站点名称
Const Def_MySiteTitle="Apc001娱乐吧"
"关键字
Const Def_Keywords="MP3下载,MP3歌曲免费下载,免费MP3歌曲下载,MP3音乐下载,免费电影,网通电影"
"系统标题
Const Def_SysTitle="Apc001娱乐吧-后台管理控制面板"
"系统标题
Const Def_Developer=""
"版权信息
Const Def_SoftCopyright_Script="\n\nApc001娱乐吧 二次开发\n"
"是否为下次登录自动记录管理员帐户
Const Def_IsAutoRemberLoginName=False
"自动记录管理员帐户名Cookie的超时时间(天)
Const Def_AutoRemberLoginName_ExpiresTime=5
"默认资源操作面板是否展开
Const Def_ShowNewsContorlPlane=False
"资源修改后是否需重新审枋
Const Def_ReCheckAfterModify=False
"退出Tsys信息发布系统时是否提示
Const Def_ConfirmWhenExitNewsSystem=True
"是否启用管理员登录安全登记
Const Def_UseLoginPolliceMan=True
"监视的时间范围(秒)
Const Def_StakeoutTimeRange=60
"允许登录错误的次数
Const Def_EnableLoginWrong_Number=6
"被封时间(秒)
Const Def_LoginWrongLockTimeRange=300
"//////////////////////////////////////////////////////////
"文件系统配制
"//////////////////////////////////////////////////////////
"虚拟文件目录,结尾请不要加“/”
Const Def_FileSystem_DirectoryRoot="/UpLoadFiles"
"允许上传的文件类型
Const Def_FileSystem_EnableFileExt="|TXT|HTML|HTM|TXT|GIF|JPG|JPEG|BMP|PNG|SWF|DOC|"
"//////////////////////////////////////////////////////////
"数据库配制
"//////////////////////////////////////////////////////////
"资源库文件地址
Dim Def_ResourceDBPath
Def_ResourceDBPath=Def_TsysRootPath & "/~Database~/~DataBase~.mdb"
Dim ConnStr
ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(Def_ResourceDBPath)
"评论数据库地址
Dim Def_CommentDBPath
Def_CommentDBPath=Def_TsysRootPath & "/Comment/ComDb.mdb"
Dim Comment_ConnStr
Comment_ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(Def_CommentDBPath)
%>
在 Minghao_WaterMarkClass.asp 中..找到
Jpeg.Canvas.DrawImage x,y,JpegMark,Op,WaterMarkImageTransColor
这一行.
如果你的水印图片颜色很....显过渡那种...这里可以改一下.
Jpeg.Canvas.DrawImage x,y,JpegMark,Op,WaterMarkImageTransColor,偏差值
改成上面那样...偏差值.可以取 0-255
就可以不用精确得过滤颜色了.自己调试着用吧.个人觉得没啥用.需要的就自己改一下.比如
Jpeg.Canvas.DrawImage x,y,JpegMark,Op,WaterMarkImageTransColor,20
问题是这样.
有人用编辑器,不只只是编辑内容而已,
更有的用来做整页模板,这样比如:
<html>
<somecode....>
<body>
bodyCode....
</body>
</html>
在代码模式中粘贴以上代码,然后在代码->编辑->代码 这样切换,看到效果了吧?只剩下少量的代码了.
在别的模式切换也一样....这就是一个小bug了.
别的不多了.看代码吧.
下面是我的editor.js 代码...懒的人,直接拷过去用.我的是最新的 3.8 Free 版.
闲着没事的,可以看下...
[code]
/* eWebEditor - eWebSoft在线编辑器 */
// 当前模式
var sCurrMode = null;
var bEditMode = null;
// 连接对象
var oLinkField = null;
//头尾部对象
var oTopCode =null;
var oBottomCode =null;
// 浏览器版本检测
var BrowserInfo = new Object() ;
BrowserInfo.MajorVer = navigator.appVersion.match(/MSIE (.)/)[1] ;
BrowserInfo.MinorVer = navigator.appVersion.match(/MSIE .\.(.)/)[1] ;
BrowserInfo.IsIE55OrMore = BrowserInfo.MajorVer >= 6 || ( BrowserInfo.MajorVer >= 5 && BrowserInfo.MinorVer >= 5 ) ;
var yToolbars = new Array(); // 工具栏数组
// 当文档完全调入时,进行初始化
var bInitialized = false;
function document.onreadystatechange(){
if (document.readyState!="complete") return;
if (bInitialized) return;
bInitialized = true;
var i, s, curr;
// 初始每个工具栏
for (i=0; i<document.body.all.length;i++){
curr=document.body.all[i];
if (curr.className == "yToolbar"){
InitTB(curr);
yToolbars[yToolbars.length] = curr;
}
}
oLinkField = parent.document.getElementsByName(sLinkFieldName)[0];
if (!config.License){
try{
eWebEditor_License.innerHTML = "&copy; <a href=&#39;
http://www.eWebSoft.com&am... target=&#39;_blank&#39;><font color=#000000>eWebSoft.com</font></a>";
}
catch(e){
}
}
// IE5.5以下版本只能使用纯文本模式
if (!BrowserInfo.IsIE55OrMore){
config.InitMode = "TEXT";
}
if (ContentFlag.value=="0") {
ContentEdit.value = oLinkField.value;
ContentLoad.value = oLinkField.value;
ModeEdit.value = config.InitMode;
ContentFlag.value = "1";
}
setMode(ModeEdit.value);
setLinkedField() ;
}
// 初始化一个工具栏上的按钮
function InitBtn(btn) {
btn.onmouseover = BtnMouseOver;
btn.onmouseout = BtnMouseOut;
btn.onmousedown = BtnMouseDown;
btn.onmouseup = BtnMouseUp;
btn.ondragstart = YCancelEvent;
btn.onsel&#101;ctstart = YCancelEvent;
btn.onsel&#101;ct = YCancelEvent;
btn.YUSERONCLICK = btn.onclick;
btn.onclick = YCancelEvent;
btn.YINITIALIZED = true;
return true;
}
//Initialize a toolbar.
function InitTB(y) {
// Set initial size of toolbar to that of the handle
y.TBWidth = 0;
// Populate the toolbar with its contents
if (! PopulateTB(y)) return false;
// Set the toolbar width and put in the handle
y.style.posWidth = y.TBWidth;
return true;
}
// Hander that simply cancels an event
function YCancelEvent() {
event.returnValue=false;
event.cancelBubble=true;
return false;
}
// Toolbar button onmouseover handler
function BtnMouseOver() {
if (event.srcElement.tagName != "IMG") return false;
var image = event.srcElement;
var element = image.parentElement;
// Change button look based on current state of image.
if (image.className == "Ico") element.className = "BtnMouseOverUp";
else if (image.className == "IcoDown") element.className = "BtnMouseOverDown";
event.cancelBubble = true;
}
// Toolbar button onmouseout handler
function BtnMouseOut() {
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
yRaisedElement = null;
element.className = "Btn";
image.className = "Ico";
event.cancelBubble = true;
}
// Toolbar button onmousedown handler
function BtnMouseDown() {
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
event.returnValue=false;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
element.className = "BtnMouseOverDown";
image.className = "IcoDown";
event.cancelBubble = true;
event.returnValue=false;
return false;
}
// Toolbar button onmouseup handler
function BtnMouseUp() {
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()");
element.className = "BtnMouseOverUp";
image.className = "Ico";
event.cancelBubble = true;
return false;
}
// Populate a toolbar with the elements within it
function PopulateTB(y) {
var i, elements, element;
// Iterate through all the top-level elements in the toolbar
elements = y.children;
for (i=0; i<elements.length; i++) {
element = elements[i];
if (element.tagName == "SCRIPT" || element.tagName == "!") continue;
switch (element.className) {
case "Btn":
if (element.YINITIALIZED == null) {
if (! InitBtn(element)) {
alert("Problem initializing:" + element.id);
return false;
}
}
element.style.posLeft = y.TBWidth;
y.TBWidth += element.offsetWidth + 1;
break;
case "TBGen":
element.style.posLeft = y.TBWidth;
y.TBWidth += element.offsetWidth + 1;
break;
case "TBSep":
element.style.posLeft = y.TBWidth + 2;
y.TBWidth += 5;
break;
case "TBHandle":
element.style.posLeft = 2;
y.TBWidth += element.offsetWidth + 7;
break;
default:
alert("Invalid class: " + element.className + " on Element: " + element.id + " <" + element.tagName + ">");
return false;
}
}
y.TBWidth += 1;
return true;
}
// 设置所属表单的提交或reset事件
function setLinkedField() {
if (! oLinkField) return ;
var oForm = oLinkField.form ;
if (!oForm) return ;
// 附加submit事件
oForm.attachEvent("onsubmit", AttachSubmit) ;
if (! oForm.submitEditor) oForm.submitEditor = new Array() ;
oForm.submitEditor[oForm.submitEditor.length] = AttachSubmit ;
if (! oForm.originalSubmit) {
oForm.originalSubmit = oForm.submit ;
oForm.submit = function() {
if (this.submitEditor) {
for (var i = 0 ; i < this.submitEditor.length ; i++) {
this.submitEditor[i]() ;
}
}
this.originalSubmit() ;
}
}
// 附加reset事件
oForm.attachEvent("onreset", AttachReset) ;
if (! oForm.resetEditor) oForm.resetEditor = new Array() ;
oForm.resetEditor[oForm.resetEditor.length] = AttachReset ;
if (! oForm.originalReset) {
oForm.originalReset = oForm.reset ;
oForm.reset = function() {
if (this.resetEditor) {
for (var i = 0 ; i < this.resetEditor.length ; i++) {
this.resetEditor[i]() ;
}
}
this.originalReset() ;
}
}
}
// 附加submit提交事件,大表单数据提交,保存eWebEditor中的内容
function AttachSubmit() {
var oForm = oLinkField.form ;
if (!oForm) return;
var html = getHTML();
ContentEdit.value = html;
if (sCurrMode=="TEXT"){
html = HTMLEncode(html);
}
splitTextField(oLinkField, html);
}
// 表单提交
function doSubmit(){
var oForm = oLinkField.form ;
if (!oForm) return ;
oForm.submit();
}
// 附加Reset事件
function AttachReset() {
if(bEditMode){
eWebEditor.document.body.innerHTML = ContentLoad.value;
}else{
eWebEditor.document.body.innerText = ContentLoad.value;
}
}
// 显示帮助
function onHelp(){
ShowDialog(&#39;dialog/help.htm&#39;,&#39;400&#39;,&#39;300&#39;);
return false;
}
// 粘贴时自动检测是否来源于Word格式
function onPaste() {
if (sCurrMode=="VIEW") return false;
if (sCurrMode=="EDIT"){
var sHTML = GetClipboardHTML() ;
if (config.AutoDetectPasteFromWord && BrowserInfo.IsIE55OrMore) {
var re = /<\w[^>]* class="?MsoNormal"?/gi ;
if ( re.test(sHTML)){
if ( confirm( "你要粘贴的内容好象是从Word中拷出来的,是否要先清除Word格式再粘贴?" ) ){
cleanAndPaste( sHTML ) ;
return false ;
}
}
}
eWebEditor.document.sel&#101;ction.cr&#101;ateRange().pasteHTML(sHTML) ;
return false;
}else{
eWebEditor.document.sel&#101;ction.cr&#101;ateRange().pasteHTML(HTMLEncode( clipboardData.getData("Text"))) ;
return false;
}
}
// 快捷键
function onKeyDown(event){
var key = String.fromCharCode(event.keyCode).toUpperCase();
// F2:显示或隐藏指导方针
if (event.keyCode==113){
showBorders();
return false;
}
if (event.ctrlKey){
// Ctrl+Enter:提交
if (event.keyCode==10){
doSubmit();
return false;
}
// Ctrl++:增加编辑区
if (key=="+"){
sizeChange(300);
return false;
}
// Ctrl+-:减小编辑区
if (key=="-"){
sizeChange(-300);
return false;
}
// Ctrl+1:代码模式
if (key=="1"){
setMode("CODE");
return false;
}
// Ctrl+2:设计模式
if (key=="2"){
setMode("EDIT");
return false;
}
// Ctrl+3:纯文本
if (key=="3"){
setMode("TEXT");
return false;
}
// Ctrl+4:预览
if (key=="4"){
setMode("VIEW");
return false;
}
}
switch(sCurrMode){
case "VIEW":
return true;
break;
case "EDIT":
if (event.ctrlKey){
// Ctrl+D:从Word粘贴
if (key == "D"){
PasteWord();
return false;
}
// Ctrl+R:查找替换
if (key == "R"){
findReplace();
return false;
}
// Ctrl+Z:Undo
if (key == "Z"){
goHistory(-1);
return false;
}
// Ctrl+Y:Redo
if (key == "Y"){
goHistory(1);
return false;
}
}
if(!event.ctrlKey && event.keyCode != 90 && event.keyCode != 89) {
if (event.keyCode == 32 || event.keyCode == 13){
saveHistory()
}
}
return true;
break;
default:
if (event.keyCode==13){
var sel = eWebEditor.document.sel&#101;ction.cr&#101;ateRange();
sel.pasteHTML("<BR>");
event.cancelBubble = true;
event.returnValue = false;
sel.sel&#101;ct();
sel.moveEnd("character", 1);
sel.moveStart("character", 1);
sel.collapse(false);
return false;
}
// 屏蔽事件
if (event.ctrlKey){
// Ctrl+B,I,U
if ((key == "B")||(key == "I")||(key == "U")){
return false;
}
}
}
}
// 取剪粘板中的HTML格式数据
function GetClipboardHTML() {
var oDiv = document.getElementById("eWebEditor_Temp_HTML")
oDiv.innerHTML = "" ;
var oTextRange = document.body.cr&#101;ateTextRange() ;
oTextRange.moveToElementText(oDiv) ;
oTextRange.execCommand("Paste") ;
var sData = oDiv.innerHTML ;
oDiv.innerHTML = "" ;
return sData ;
}
// 清除WORD冗余格式并粘贴
function cleanAndPaste( html ) {
// Remove all SPAN tags
html = html.replace(/<\/?SPAN[^>]*>/gi, "" );
// Remove Class attributes
html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove Style attributes
html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
// Remove Lang attributes
html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove XML elements and declarations
html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
// Remove Tags with XML namespace declarations: <o:p></o:p>
html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
// Replace the &nbsp;
html = html.replace(/&nbsp;/, " " );
// Transform <P> to <DIV>
var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ; // Different because of a IE 5.0 error
html = html.replace( re, "<div$2</div>" ) ;
ins&#101;rtHTML( html ) ;
}
// 在当前文档位置插入.
function ins&#101;rtHTML(html) {
if (isModeView()) return false;
if (eWebEditor.document.sel&#101;ction.type.toLowerCase() != "none"){
eWebEditor.document.sel&#101;ction.clear() ;
}
if (sCurrMode!="EDIT"){
html=HTMLEncode(html);
}
eWebEditor.document.sel&#101;ction.cr&#101;ateRange().pasteHTML(html) ;
}
// 设置编辑器的内容
function setHTML(html) {
ContentEdit.value = html;
switch (sCurrMode){
case "CODE":
eWebEditor.document.designMode="On";
eWebEditor.document.open();
eWebEditor.document.write(config.StyleEditorHeader);
eWebEditor.document.body.innerText=oTopCode + html + oBottomCode;
eWebEditor.document.body.contentEditable="true";
eWebEditor.document.close();
bEditMode=false;
break;
case "EDIT":
eWebEditor.document.designMode="On";
eWebEditor.document.open();
//eWebEditor.document.write(config.StyleEditorHeader+html);
var haoHtml,haoB,haoC,haoD,haoE;
haoHtml=html.toLowerCase();
if(haoHtml.indexOf("<body")!=-1 && haoHtml.indexOf("</body>")!=-1)
{
haoB=haoHtml.indexOf("<body");
haoC=haoHtml.indexOf("</body>");
haoD=haoHtml.substring(haoB,haoC+7) //中间的长度
haoE=haoD.substring(0,haoD.indexOf(">")+1);
oTopCode=haoHtml.substring(0,haoB) + haoE;
oBottomCode="</body>" + haoHtml.substring(haoC+7);
eWebEditor.document.write(html);
}
else
{
oTopCode="";
oBottomCode="";
eWebEditor.document.write(config.StyleEditorHeader+html);
}
//alert(config.StyleEditorHeader);
eWebEditor.document.body.contentEditable="true";
eWebEditor.document.execCommand("2D-Position",true,true);
eWebEditor.document.execCommand("MultipleSel&#101;ction", true, true);
eWebEditor.document.execCommand("LiveResize", true, true);
eWebEditor.document.close();
doZoom(nCurrZoomSize);
bEditMode=true;
eWebEditor.document.onsel&#101;ctionchange = function () { doToolbar();}
break;
case "TEXT":
eWebEditor.document.designMode="On";
eWebEditor.document.open();
eWebEditor.document.write(config.StyleEditorHeader);
eWebEditor.document.body.innerText=html;
eWebEditor.document.body.contentEditable="true";
eWebEditor.document.close();
bEditMode=false;
break;
case "VIEW":
eWebEditor.document.designMode="off";
eWebEditor.document.open();
//eWebEditor.document.write(config.StyleEditorHeader+html);
var haoHtml,haoB,haoC,haoD,haoE;
haoHtml=html.toLowerCase();
if(haoHtml.indexOf("<body")!=-1 && haoHtml.indexOf("</body>")!=-1)
{
haoB=haoHtml.indexOf("<body");
haoC=haoHtml.indexOf("</body>");
haoD=haoHtml.substring(haoB,haoC+7) //中间的长度
haoE=haoD.substring(0,haoD.indexOf(">")+1);
oTopCode=haoHtml.substring(0,haoB) + haoE;
oBottomCode="</body>" + haoHtml.substring(haoC+7);
eWebEditor.document.write(html);
}
else
{
oTopCode="";
oBottomCode="";
eWebEditor.document.write(config.StyleEditorHeader+html);
}
eWebEditor.document.body.contentEditable="false";
eWebEditor.document.close();
bEditMode=false;
break;
}
eWebEditor.document.body.onpaste = onPaste ;
eWebEditor.document.body.onhelp = onHelp ;
eWebEditor.document.onkeydown = new Function("return onKeyDown(eWebEditor.event);");
eWebEditor.document.oncontextmenu=new Function("return showContextMenu(eWebEditor.event);");
if ((borderShown != "0")&&bEditMode) {
borderShown = "0";
showBorders();
}
initHistory();
}
// 取编辑器的内容
function getHTML() {
var html;
if((sCurrMode=="EDIT")||(sCurrMode=="VIEW")){
html = eWebEditor.document.body.innerHTML;
}else{
html = eWebEditor.document.body.innerText;
}
if (sCurrMode!="TEXT"){
if ((html.toLowerCase()=="<p>&nbsp;</p>")||(html.toLowerCase()=="<p></p>")){
html = "";
}
}
return html;
}
// 在尾部追加内容
function appendHTML(html) {
if (isModeView()) return false;
if(sCurrMode=="EDIT"){
eWebEditor.document.body.innerHTML += html;
}else{
eWebEditor.document.body.innerText += html;
}
}
// 从Word中粘贴,去除格式
function PasteWord(){
if (!validateMode()) return;
eWebEditor.focus();
if (BrowserInfo.IsIE55OrMore)
cleanAndPaste( GetClipboardHTML() ) ;
else if ( confirm( "此功能要求IE5.5版本以上,你当前的浏览器不支持,是否按常规粘贴进行?" ) )
format("paste") ;
eWebEditor.focus();
}
// 粘贴纯文本
function PasteText(){
if (!validateMode()) return;
eWebEditor.focus();
var sText = HTMLEncode( clipboardData.getData("Text") ) ;
ins&#101;rtHTML(sText);
eWebEditor.focus();
}
// 检测当前是否允许编辑
function validateMode() {
if (sCurrMode=="EDIT") return true;
alert("需转换为编辑状态后才能使用编辑功能!");
eWebEditor.focus();
return false;
}
// 检测当前是否在预览模式
function isModeView(){
if (sCurrMode=="VIEW"){
alert("预览时不允许设置编辑区内容。");
return true;
}
return false;
}
// 格式化编辑器中的内容
function format(what,opt) {
if (!validateMode()) return;
eWebEditor.focus();
if (opt=="RemoveFormat") {
what=opt;
opt=null;
}
if (opt==null) eWebEditor.document.execCommand(what);
else eWebEditor.document.execCommand(what,"",opt);
eWebEditor.focus();
}
// 确保焦点在 eWebEditor 内
function VerifyFocus() {
if ( eWebEditor )
eWebEditor.focus();
}
// 改变模式:代码、编辑、文本、预览
function setMode(NewMode){
if (NewMode!=sCurrMode){
if (!BrowserInfo.IsIE55OrMore){
if ((NewMode=="CODE") || (NewMode=="EDIT") || (NewMode=="VIEW")){
alert("HTML编辑模式需要IE5.5版本以上的支持!");
return false;
}
}
if (NewMode=="TEXT"){
if (sCurrMode==ModeEdit.value){
if (!confirm("警告!切换到纯文本模式会丢失您所有的HTML格式,您确认切换吗?")){
return false;
}
}
}
document.all["Editor_CODE"].style.display = "none";
document.all["Editor_EDIT"].style.display = "none";
document.all["Editor_VIEW"].style.display = "none";
document.all["Editor_"+NewMode].style.display = "block";
var sBody = "";
switch(sCurrMode){
case "CODE":
if (NewMode=="TEXT"){
eWebEditor_Temp_HTML.innerHTML = eWebEditor.document.body.innerText;
sBody = eWebEditor_Temp_HTML.innerText;
}else{
sBody = eWebEditor.document.body.innerText;
//alert(&#39;ok&#39;);
}
break;
case "TEXT":
sBody = eWebEditor.document.body.innerText;
sBody = HTMLEncode(sBody);
break;
case "EDIT":
case "VIEW":
if (NewMode=="TEXT"){
sBody = eWebEditor.document.body.innerText;
}else{
sBody = eWebEditor.document.body.innerHTML;
}
break;
default:
sBody = ContentEdit.value;
break;
}
// 换图片
/*try{
document.all["eWebEditor_CODE"].className = "StatusBarBtnOff";
document.all["eWebEditor_EDIT"].className = "StatusBarBtnOff";
document.all["eWebEditor_TEXT"].className = "StatusBarBtnOff";
document.all["eWebEditor_VIEW"].className = "StatusBarBtnOff";
document.all["eWebEditor_"+NewMode].className = "StatusBarBtnOn";
}
catch(e){
}
*/
sCurrMode = NewMode;
ModeEdit.value = NewMode;
setHTML(sBody);
disableChildren(eWebEditor_Toolbar);
}
}
// 使工具栏无效
function disableChildren(obj){
if (obj){
obj.disabled=(!bEditMode);
for (var i=0; i<obj.children.length; i++){
disableChildren(obj.children[i]);
}
}
}
// 显示无模式对话框
function ShowDialog(url, width, height, optValidate) {
if (optValidate) {
if (!validateMode()) return;
}
eWebEditor.focus();
var arr = showModalDialog(url, window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
eWebEditor.focus();
}
// 全屏编辑
function Maximize() {
if (!validateMode()) return;
window.open("dialog/fullscreen.htm?style="+config.StyleName, &#39;FullScreen&#39;+sLinkFieldName, &#39;toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,fullscreen=yes&#39;);
}
// 创建或修改超级链接
function cr&#101;ateLink(){
if (!validateMode()) return;
if (eWebEditor.document.sel&#101;ction.type == "Control") {
var oControlRange = eWebEditor.document.sel&#101;ction.cr&#101;ateRange();
if (oControlRange(0).tagName.toUpperCase() != "IMG") {
alert("链接只能是图片或文本");
return;
}
}
ShowDialog("dialog/hyperlink.htm", 350, 170, true);
}
// 替换特殊字符
function HTMLEncode(text){
text = text.replace(/&/g, "&amp;") ;
text = text.replace(/"/g, "&quot;") ;
text = text.replace(/</g, "&lt;") ;
text = text.replace(/>/g, "&gt;") ;
text = text.replace(/&#39;/g, "&#146;") ;
text = text.replace(/\ /g,"&nbsp;");
text = text.replace(/\n/g,"<br>");
text = text.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");
return text;
}
// 插入特殊对象
function ins&#101;rt(what) {
if (!validateMode()) return;
eWebEditor.focus();
var sel = eWebEditor.document.sel&#101;ction.cr&#101;ateRange();
switch(what){
case "excel": // 插入EXCEL表格
ins&#101;rtHTML("<object classid=&#39;clsid:0002E510-0000-0000-C000-000000000046&#39; id=&#39;Spreadsheet1&#39; codebase=&#39;file:\\Bob\software\office2000\msowc.cab&#39; width=&#39;100%&#39; height=&#39;250&#39;><param name=&#39;HTMLURL&#39; value><param name=&#39;HTMLData&#39; value=&#39;&lt;html xmlns:x=&quot;urn:schemas-microsoft-com:office:excel&quot;xmlns=&quot;
http://www.w3.org/TR/REC-h... type=&quot;text/css&quot;&gt;&lt;!--tr{mso-height-source:auto;}td{black-space:nowrap;}.wc4590F88{black-space:nowrap;font-family:宋体;mso-number-format:General;font-size:auto;font-weight:auto;font-style:auto;text-decoration:auto;mso-background-source:auto;mso-pattern:auto;mso-color-source:auto;text-align:general;vertical-align:bottom;border-top:none;border-left:none;border-right:none;border-bottom:none;mso-protection:locked;}--&gt;&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;&lt;x:ExcelWorkbook&gt;&lt;x:ExcelWorksheets&gt;&lt;x:ExcelWorksheet&gt;&lt;x:OWCVersion&gt;9.0.0.2710&lt;/x:OWCVersion&gt;&lt;x:Label Style=&#39;border-top:solid .5pt silver;border-left:solid .5pt silver;border-right:solid .5pt silver;border-bottom:solid .5pt silver&#39;&gt;&lt;x:Caption&gt;Microsoft Office Spreadsheet&lt;/x:Caption&gt; &lt;/x:Label&gt;&lt;x:Name&gt;Sheet1&lt;/x:Name&gt;&lt;x:WorksheetOptions&gt;&lt;x:Sel&#101;cted/&gt;&lt;x:Height&gt;7620&lt;/x:Height&gt;&lt;x:Width&gt;15240&lt;/x:Width&gt;&lt;x:TopRowVisible&gt;0&lt;/x:TopRowVisible&gt;&lt;x:LeftColumnVisible&gt;0&lt;/x:LeftColumnVisible&gt; &lt;x:ProtectContents&gt;False&lt;/x:ProtectContents&gt; &lt;x:DefaultRowHeight&gt;210&lt;/x:DefaultRowHeight&gt; &lt;x:StandardWidth&gt;2389&lt;/x:StandardWidth&gt; &lt;/x:WorksheetOptions&gt; &lt;/x:ExcelWorksheet&gt;&lt;/x:ExcelWorksheets&gt; &lt;x:MaxHeight&gt;80%&lt;/x:MaxHeight&gt;&lt;x:MaxWidth&gt;80%&lt;/x:MaxWidth&gt;&lt;/x:ExcelWorkbook&gt;&lt;/xml&gt;&lt;![endif]--&gt;&lt;table class=wc4590F88 x:str&gt;&lt;col width=&quot;56&quot;&gt;&lt;tr height=&quot;14&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;&#39;> <param name=&#39;DataType&#39; value=&#39;HTMLDATA&#39;> <param name=&#39;AutoFit&#39; value=&#39;0&#39;><param name=&#39;DisplayColHeaders&#39; value=&#39;-1&#39;><param name=&#39;DisplayGridlines&#39; value=&#39;-1&#39;><param name=&#39;DisplayHorizontalScrollBar&#39; value=&#39;-1&#39;><param name=&#39;DisplayRowHeaders&#39; value=&#39;-1&#39;><param name=&#39;DisplayTitleBar&#39; value=&#39;-1&#39;><param name=&#39;DisplayToolbar&#39; value=&#39;-1&#39;><param name=&#39;DisplayVerticalScrollBar&#39; value=&#39;-1&#39;> <param name=&#39;EnableAutoCalculate&#39; value=&#39;-1&#39;> <param name=&#39;EnableEvents&#39; value=&#39;-1&#39;><param name=&#39;MoveAfterReturn&#39; value=&#39;-1&#39;><param name=&#39;MoveAfterReturnDirection&#39; value=&#39;0&#39;><param name=&#39;RightToLeft&#39; value=&#39;0&#39;><param name=&#39;ViewableRange&#39; value=&#39;1:65536&#39;></object>");
break;
case "nowdate": // 插入当前系统日期
var d = new Date();
ins&#101;rtHTML(d.toLocaleDateString());
break;
case "nowtime": // 插入当前系统时间
var d = new Date();
ins&#101;rtHTML(d.toLocaleTimeString());
break;
case "br": // 插入换行符
ins&#101;rtHTML("<br>")
break;
case "code": // 代码片段样式
ins&#101;rtHTML(&#39;<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed"><tr><td bgcolor=#FDFDDF style="WORD-WRAP: break-word"><font style="color: #990000;font-weight:bold">以下是代码片段:</font><br>&#39;+HTMLEncode(sel.text)+&#39;</td></tr></table>&#39;);
break;
case "quote": // 引用片段样式
ins&#101;rtHTML(&#39;<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed"><tr><td bgcolor=#F3F3F3 style="WORD-WRAP: break-word"><font style="color: #990000;font-weight:bold">以下是引用片段:</font><br>&#39;+HTMLEncode(sel.text)+&#39;</td></tr></table>&#39;);
break;
case "big": // 字体变大
ins&#101;rtHTML("<big>" + sel.text + "</big>");
break;
case "small": // 字体变小
ins&#101;rtHTML("<small>" + sel.text + "</small>");
break;
case "SplitPage": // 插入分页符
ins&#101;rtHTML("<HR sysPageSplitFlag>");
break;
default:
if(what.substring(0,2)==&#39;{$&#39;){ins&#101;rtHTML(what);break;}
alert("错误参数调用!");
break;
}
sel=null;
}
// 显示或隐藏指导方针
var borderShown = config.ShowBorder;
function showBorders() {
if (!validateMode()) return;
var allForms = eWebEditor.document.body.getElementsByTagName("FORM");
var allInputs = eWebEditor.document.body.getElementsByTagName("INPUT");
var allTables = eWebEditor.document.body.getElementsByTagName("TABLE");
var allLinks = eWebEditor.document.body.getElementsByTagName("A");
// 表单
for (a=0; a < allForms.length; a++) {
if (borderShown == "0") {
allForms[a].runtimeStyle.border = "1px dotted #FF0000"
} else {
allForms[a].runtimeStyle.cssText = ""
}
}
// Input Hidden类
for (b=0; b < allInputs.length; b++) {
if (borderShown == "0") {
if (allInputs[b].type.toUpperCase() == "HIDDEN") {
allInputs[b].runtimeStyle.border = "1px dashed #000000"
allInputs[b].runtimeStyle.width = "15px"
allInputs[b].runtimeStyle.height = "15px"
allInputs[b].runtimeStyle.backgroundColor = "#FDADAD"
allInputs[b].runtimeStyle.color = "#FDADAD"
}
} else {
if (allInputs[b].type.toUpperCase() == "HIDDEN")
allInputs[b].runtimeStyle.cssText = ""
}
}
// 表格
for (i=0; i < allTables.length; i++) {
if (borderShown == "0") {
allTables[i].runtimeStyle.border = "1px dotted #BFBFBF"
} else {
allTables[i].runtimeStyle.cssText = ""
}
allRows = allTables[i].rows
for (y=0; y < allRows.length; y++) {
allCellsInRow = allRows[y].cells
for (x=0; x < allCellsInRow.length; x++) {
if (borderShown == "0") {
allCellsInRow[x].runtimeStyle.border = "1px dotted #BFBFBF"
} else {
allCellsInRow[x].runtimeStyle.cssText = ""
}
}
}
}
// 链接 A
for (a=0; a < allLinks.length; a++) {
if (borderShown == "0") {
if (allLinks[a].href.toUpperCase() == "") {
allLinks[a].runtimeStyle.borderBottom = "1px dashed #000000"
}
} else {
allLinks[a].runtimeStyle.cssText = ""
}
}
if (borderShown == "0") {
borderShown = "1"
} else {
borderShown = "0"
}
scrollUp()
}
// 返回页面最上部
function scrollUp() {
eWebEditor.scrollBy(0,0);
}
// 缩放操作
var nCurrZoomSize = 100;
var aZoomSize = new Array(10, 25, 50, 75, 100, 150, 200, 500);
function doZoom(size) {
eWebEditor.document.body.runtimeStyle.zoom = size + "%";
nCurrZoomSize = size;
}
// 拼写检查
function spellCheck(){
ShowDialog(&#39;dialog/spellcheck.htm&#39;, 300, 220, true)
}
// 查找替换
function findReplace(){
ShowDialog(&#39;dialog/findreplace.htm&#39;, 320, 165, true)
}
// 相对(absolute)或绝对位置(static)
function absolutePosition(){
var objReference = null;
var RangeType = eWebEditor.document.sel&#101;ction.type;
if (RangeType != "Control") return;
var sel&#101;ctedRange = eWebEditor.document.sel&#101;ction.cr&#101;ateRange();
for (var i=0; i<sel&#101;ctedRange.length; i++){
objReference = sel&#101;ctedRange.item(i);
if (objReference.style.position != &#39;absol