⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inedit.htm

📁 一个实现邮件收发功能的客户端程序
💻 HTM
📖 第 1 页 / 共 4 页
字号:
	if (strInput == '' || !strInput) {strSearch='';return false;}
	if (strInput != strSearch)
	{   
	   blnIsNew = true;
	   strSearch = strInput;
	   oRange=bRange.duplicate();
	      
	} 
	else
		blnIsNew=false;
		
	if (blnIsNew)
	{
	   if (oWhole.indexOf(strSearch)>=0)
	   {
	       intStart=intEnd+oWhole.indexOf(strSearch);
		   intEnd=intStart+parseInt(strSearch.length,10);
		   oRange.moveEnd("character",-iScope);
           oRange.moveEnd("character",intEnd);
		   oRange.moveStart("character",intStart);
		   oRange.select();
		   oWhole=oWhole.substring(oWhole.indexOf(strSearch)+parseInt(strSearch.length,10),iScope);
		   strSearch='';
		   _Search2(strInput,iScope,iFlag);
	   }
	   	else
		{ 
		   intStart=intEnd=0;
		   var b = window.confirm('搜索已经到达文档结尾处,是否重新搜索?');
		   if (b) 
		   {strSearch='';_doSearch();}
		   else
		   {
		     strSearch='';
		   }
		}   
    }
	else
	{ 
	   intStart=intEnd=0;
	   strSearch='';
	   alert('未找到查找内容!'); 
	}
}

/*******************************/
 //方法: _Editor_DblClickHandler
 //编辑器ondblclick句柄
/******************************/
function _Editor_DblClickHandler(){
var el=this.parentWindow.event.srcElement
if(el.tagName=="IMG"){
el.removeAttribute("width")
el.removeAttribute("height")
el.style.removeAttribute("width")
el.style.removeAttribute("height")
el.width=el.width
el.height=el.height
}
if(el.tagName=="TABLE")
_CPopup_Show('Table')
}
/*******************************/
 //方法: _setSize
 //编辑器设置大小
 /******************************/
function _setSize(){
document.all.idEditbox.style.pixelHeight=document.body.clientHeight - idToolbar.offsetHeight - document.all.idMode.offsetHeight
document.all.idPopup.style.pixelLeft=(document.body.clientWidth - idPopup.document.all.puRegion.offsetWidth)/ 2
document.all.idPopup.style.pixelLeft=(document.body.clientWidth)/ 2
}
/*******************************/
 //方法: _drawToolbar
 //编辑器画功能区
/******************************/
function _drawToolbar()
{
var aIds=new Array("cut","copy","paste","bar1","undo","redo","bar2","link","table","image","bar3","formatblock","fontstyle","fontsize","bar4","bold","italic","underline","bar5","left","center","right","bar6","orderedlist","unorderedlist","outdent","indent","bar7","textcolor")
var aTips=new Array("剪切","复制","粘贴","","撤销","恢复","","超链接","插入表格","插入图片","","字体格式","字体","字体尺寸","","加粗","斜体","下划线","","左对齐","居中","右对齐","","编号","项目符号","减少缩进","增加缩进","","字体颜色")
var aCommand=new Array("_Format('cut')","_Format('copy')","_Format('paste')",null,"_Format('Undo')","_Format('Redo')",null,"_CPopup_Show('Link')","_CPopup_Show('Table')","_CPopup_Show('Image')",null,"_CPopup_Show('formatblock')","_CPopup_Show('font')","_CPopup_Show('fontsize')",null,"_Format('bold')","_Format('italic')","_Format('underline')",null,"_Format('Justify','Left')","_Format('Justify','Center')","_Format('Justify','Right')",null,"_Format('insertorderedlist')","_Format('insertunorderedlist')","_Format('outdent')","_Format('indent')",null,"_CPopup_Show('ForeColor')")
var sz="<DIV ID=idStandardBar><NOBR>",iLeft=0,iHeight=24
for(var i=0 ;i<aSizes.length;i++)
{
sz+="<SPAN CLASS=tbButton ONKEYPRESS=\"if(event.keyCode==13){"+aCommand[i]+";event.keyCode=0}\" ID=\"tb"+aIds[i]+"\" STYLE=\"width:"+aSizes[i]+";height:"+iHeight+"\">" +"<SPAN STYLE=\"position:absolute;width:"+aSizes[i]+";height:"+iHeight+";clip:rect(0 "+aSizes[i]+" "+iHeight+" 0)\"><IMG ALT=\""+aTips[i]+"\" TITLE=\""+aTips[i]+"\" ONCLICK=\""+aCommand[i]+";event.cancelBubble=true\" ONMOUSEDOWN=\"if(event.button==1)this.style.pixelTop=-"+(iHeight*2)+"\" ONMOUSEOVER=\"this.style.pixelTop=-"+iHeight+"\" ONMOUSEOUT=\"this.style.pixelTop=0\" ONMOUSEUP=\"this.style.pixelTop=-"+iHeight+"\" SRC=\""+L_TOOLBARGIF_TEXT+"\" STYLE=\"position:absolute;top:0;left:-"+iLeft+"\"></SPAN></SPAN>" +(aTips[i]==""?"</NOBR><NOBR>":"")
iLeft+=aSizes[i]
}
sz+="</NOBR>"
document.write(sz+"</DIV>")
}
/*******************************/
 //方法: _drawModeSelect
 //编辑器画MODE区
/******************************/
function _drawModeSelect(){
var sz="<TABLE CELLSPACING=0 CELLPADDING=0 ID=idMode></TABLE>"
document.write(sz)
}
/*******************************/
 //方法: _CState
 //对象,存储各种状态和对象变量
/******************************/
function _CState()
{
this.hasFocus=true
this.selection=null
this.bMode=true
this.customButtons=false
this.css=this.bgColor="#FFFFFF"
this.defaultSkin=document.styleSheets.skin.cssText
this.popupSkin=document.styleSheets.popupSkin.cssText
this.szSearch=location.search.substring(1)
this.aBindings=new Array()
this.aListPopups=new Object()
this.aCache=new Object()
this.bLoaded=false
this.oPhoto=null
this.RestoreSelection=_CState_RestoreSelection
this.GetSelection=_CState_GetSelection
this.SaveSelection=_CState_SaveSelection
}
function _CState_RestoreSelection()
{
if(this.selection)this.selection.select()
}
function _CState_GetSelection()
{
var oSel=this.selection
if(!oSel){
oSel=idEditbox.document.selection.createRange()
oSel.type=idEditbox.document.selection.type
}
return oSel
}
function _CState_SaveSelection()
{
try
{
this.selection=idEditbox.document.selection.createRange()
if(!this.selection)
this.selection=new Object
this.selection.type=idEditbox.document.selection.type
}
catch(x)
{alert(x.message)}
}
/*******************************/
 //方法: _CPopup_Init
 //编辑器初始化弹出功能菜单
/******************************/
function _CPopup_Init()
{
var sz="<HTML ID=popup><STYLE>" +document.styleSheets.defPopupSkin.cssText +"\n" +document.styleSheets.popupSkin.cssText +"</STYLE><BODY ONCONTEXTMENU=\"return false\" ONSCROLL=\"return false\" SCROLL=no TABINDEX=-1 ONSELECTSTART=\"return event.srcElement.tagName=='INPUT'\" ><DIV ID=puRegion><TABLE ID=header><TR><TH NOWRAP ID=caption></TH><TH VALIGN=middle ALIGN=RIGHT><DIV ID=close ONCLICK=\"parent._CPopup_Hide()\">×</DIV></TH></TR></TABLE><DIV ALIGN=CENTER ID=content></DIV></DIV></BODY></HTML>"
idPopup.document.open("text/html","replace")
idPopup.document.write(sz)
idPopup.document.close()
}
/*******************************/
 //方法: _CPopup_Hide
 //编辑器隐藏功能弹出菜单
/******************************/
function _CPopup_Hide()
{
document.all.idPopup.style.zIndex=-1
document.all.idPopup.style.visibility="hidden"
try
{
var popObj = idPopup.document
idPopup.document._type=""
idPopup.document.onkeydown=idPopup.document.onmouseover=idPopup.document.onclick=null
}
catch(x)
{}
//add
idEditbox.document.body.focus()
g_state.hasFocus=true
}
/*******************************/
 //方法: _CPopup_Show
 //编辑器显示弹出菜单
/******************************/
function _CPopup_Show(szType)
{
var oRenderer,szCacheKey="PopupRenderer."+szType
if(!isIE4)
{ g_state.SaveSelection()}
if(idPopup.document._type==szType)
{ 
  _CPopup_Hide()
}
else
{
document.all.idPopup.style.zIndex=-1
oRenderer=g_state.aCache[szCacheKey]
if((!oRenderer)||("Search"==szType)||("Image"==szType)||("Link"==szType))
{
g_state.aCache[szCacheKey]=oRenderer=new _CPopupRenderer(szType)
}
document.all.idPopup.style.visibility=""
document.all.idPopup.style.pixelHeight=document.all.idPopup.style.pixelWidth=idPopup.document.all.puRegion.style.pixelHeight=idPopup.document.all.puRegion.style.pixelWidth=50
idPopup.document._type=szType
idPopup.document._renderer=oRenderer
idPopup.document.all.caption.innerText=oRenderer.GetCaption()
idPopup.document.all.content.innerHTML=oRenderer.GetHTML()
idPopup.document.onkeydown=new Function("this._renderer.OnKeyDown()")
idPopup.document.onmouseover=new Function("this._renderer.OnMouseOver()")
idPopup.document.onclick=new Function("this._renderer.OnClick()")
oRenderer.ResetContext(idPopup.document)
setTimeout("_CPopupRenderer_Display('"+szType+"')",100)
}
}
/*******************************/
 //方法: _CPopupRenderer_Display
 //编辑器功能子菜单显示
/******************************/
function _CPopupRenderer_Display(szType){
var oRenderer,szCacheKey="PopupRenderer."+szType
oRenderer=g_state.aCache[szCacheKey]
if(oRenderer.autoSize){
idPopup.document.all.puRegion.style.pixelHeight=document.all.idPopup.style.pixelHeight=idPopup.document.all.puRegion.offsetHeight
idPopup.document.all.puRegion.style.pixelWidth=document.all.idPopup.style.pixelWidth=idPopup.document.all.puRegion.offsetWidth+50
document.all.idPopup.style.pixelLeft=(document.body.clientWidth - idPopup.document.all.puRegion.offsetWidth)/ 2
}
else{
idPopup.document.all.puRegion.style.pixelHeight=document.all.idPopup.style.pixelHeight=document.body.clientHeight - idToolbar.offsetHeight- document.all.idMode.offsetHeight-20
idPopup.document.all.puRegion.style.pixelWidth=document.all.idPopup.style.pixelWidth=document.body.clientWidth - 50
document.all.idPopup.style.pixelLeft=25
}
document.all.idPopup.style.zIndex=2
idPopup.focus()
if (szType=="Search") idPopup.document.all.txtSearch.focus()
}
/*******************************/
 //方法: _CPopupRenderer
 //对象,控制功能弹出菜单
/******************************/
function _CPopupRenderer(szType)
{
this.szType=szType
this.elCurrent=this.oDocument=null
this.ResetContext=_CPopupRenderer_ResetContext
this.GetCaption=_CPopupRenderer_GetCaption
this.GetHTML=_CPopupRenderer_GetHTML
this.autoSize=true
this.OnMouseOver=new Function()
this.OnKeyDown=_CListPopupRenderer_GenericOnKeyDown
switch(szType)
{
case "formatblock":
case "font":
case "fontsize":
this.OnMouseOver= _CListPopupRenderer_OnMouseOver
this.OnKeyDown=_CListPopupRenderer_OnKeyDown
case "ForeColor":
this.OnClick=_CListPopupRenderer_OnClick
this.Highlight=_CListPopupRenderer_Highlight
this.Select=_CListPopupRenderer_Select
break
default:
this.OnClick=new Function()
break
}
switch(szType)
{
case "formatblock":
this.szCaption="选择当前字体格式"
this.PrepareHTML=_CFormatBlockPopupRenderer_PrepareHTML
this.szHTML=this.PrepareHTML()
break
case "font":
this.szCaption="选择当前字体"
this.PrepareHTML=_CFontFacesPopupRenderer_PrepareHTML
this.szHTML=this.PrepareHTML()
break
case "fontsize":
this.szCaption="选择当前字体尺寸"
this.PrepareHTML = _CFontSizesPopupRenderer_PrepareHTML2 //_CFontSizesPopupRenderer_PrepareHTML
this.szHTML=this.PrepareHTML()
break
case "Link":
this.szCaption="创建、修改链接"
this.PrepareHTML=_CLinkPopupRenderer_PrepareHTML
this.szHTML=this.PrepareHTML()
break
case "Image":
this.szCaption="创建、修改图片"
this.PrepareHTML=_CImagePopupRenderer_PrepareHTML
this.szHTML=this.PrepareHTML()
break
case "Table":
this.szCaption="创建、修改表格"
this.PrepareHTML=_CTablePopupRenderer_PrepareHTML
this.szHTML=this.PrepareHTML()
break
case "ForeColor":
this.szCaption="选择当前字体颜色"
this.szHTML="<DIV ID=ColorPopup ALIGN=CENTER>"+_CUtil_BuildColorTable("")+"</DIV>"
break
case "Search":
this.szCaption="查找"
this.PrepareHTML=_CSearchPopupRenderer_PrepareHTML
this.szHTML=this.PrepareHTML()
break
default:
this.szCaption=""
break
}
}
function _CPopupRenderer_ResetContext(oDoc)
{
this.oDocument=oDoc
this.elCurrent=null
if(this.szType=="Table"){
var oSel=idEditbox.document.selection.createRange()
var oBlock=(oSel.parentElement!=null?_CUtil_GetElement(oSel.parentElement(),"TABLE"):_CUtil_GetElement(oSel.item(0),"TABLE"))
if(oBlock!=null){
oDoc.all.tabEdit.className=""
oDoc.all.tabEditBodytxtPadding.value=oBlock.cellPadding
oDoc.all.tabEditBodytxtSpacing.value=oBlock.cellSpacing
oDoc.all.tabEditBodytxtBorder.value=oBlock.border
oDoc.all.tabEditBodytxtBorderColor.value=oBlock.borderColor
oDoc.all.tabEditBodytxtBackgroundImage.value=oBlock.background
oDoc.all.tabEditBodytxtBackgroundColor.value=oBlock.bgColor
}
oDoc.elCurrent=oBlock
}
}
function _CPopupRenderer_GetCaption()
{
return this.szCaption
}
function _CPopupRenderer_GetHTML()
{
return this.szHTML
}
function _CFontSizesPopupRenderer_PrepareHTML()
{
var sz="<TABLE ALIGN=center ID=idList CELLSPACING=0 CELLPADDING=0>"
for(var i=1;i <= 7;i++)
{
sz+="<TR><TD NOWRAP _item="+i+" ALIGN=center STYLE=\"margin:0pt;padding:0pt\"><FONT SIZE="+i+">" +"脉搏集团("+i+")</FONT></TD></TR>"
}
sz+="</TABLE>"
return sz
}

function _CFontSizesPopupRenderer_PrepareHTML2()
{
var sz="<TABLE ALIGN=center  CELLSPACING=0 CELLPADDING=0  style='font-size:14.9px'>"
sz += "<TR>"
sz += "<TD><br><NOBR>"
sz += "<INPUT id='radDefault' type='radio' value='0' name='FontGroup'> 默认字体: "
sz += "<SELECT id='selDefault' style='WIDTH: 64px' name='selDefault'>"
sz += "<OPTION selected value='1'>1号</OPTION>"
sz += "<OPTION value='2'>2号</OPTION>"
sz += "<OPTION value='3'>3号</OPTION>"
sz += "<OPTION value='4'>4号</OPTION>"
sz += "<OPTION value='5'>5号</OPTION>"
sz += "<OPTION value='6'>6号</OPTION>"
sz += "<OPTION value='7'>7号</OPTION>"
sz += "</SELECT></NOBR><br>&nbsp;<font color='#191970'>(应用于当前选中文字)</font>"
sz += "</TD>"
sz += "</TR>"
sz += "<TR>"
sz += "<TD><BR><nobr>"
sz += "<INPUT id='radCustom' type='radio' CHECKED value='1' name='FontGroup'> 自定义:  "
sz += "大小 <INPUT id='txtSize' style='WIDTH: 50px; HEIGHT: 22px' type='text' size='1' value='14.9' maxlength='4' name='txtSize'>"
sz += " 单位 <SELECT id='selCustom' name='selCustom'>"
sz += "<OPTION  value='pt'>磅</OPTION>"
sz += "<OPTION  selected value='px'>像素</OPTION>"
sz += "<OPTION value='%'>百分比</OPTION>"
sz += "</SELECT></nobr><br>&nbsp;<font color='#191970'>(应用于包含当前选中文字的整个段落)</font>"
sz += "</TD>"
//sz += "</TR><TR><TD><br>行间距:  <input id='txtLineHeight' style='width:40px',type='text' maxlength='4' name='txtLineHeight' value=''>"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -