JavaScript通用库 二 .doc_第1页
JavaScript通用库 二 .doc_第2页
JavaScript通用库 二 .doc_第3页
JavaScript通用库 二 .doc_第4页
JavaScript通用库 二 .doc_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

/*IsEnLetter(string,string):测试字符串,大小写(UL,U,L or ul,u,l)*/function IsEnLetter(objStr,size) var reg; if(Trim(objStr)=“) return false; else objStr=objStr.toString(); if(size=null)|(Trim(size)=“) size=“UL“; else size=size.toUpperCase(); switch(size) case “UL“: /大小写 reg=/A-Za-z+$/; break; case “U“: /大写 reg=/A-Z+$/; break; case “L“: /小写 reg=/a-z+$/; break; default: alert(“检查大小写参数,只可为(空、UL、U、L)“); return false; break; var r=objStr.match(reg); if(r=null) return false; else return true; /*=功能:鼠标小提示作者:申旺日期:2004/04/15=*/定义变量、设置默认值var LabelFontFace=“宋体,arial,Verdana“;var LabelFontColor=“#000000“;var LabelFontSize=“9pt“;var LabelFontStyle=“Font.PLAIN“;var LabelBorderColor=“#000000“;var LabelBackColor=“#FFFFE1“;/设置各个属性function SetLabelFontFace(obj) obj=Trim(obj); if(obj=null | obj=“) obj=“宋体,arial,Verdana“; LabelFontFace=obj;function SetLabelFontColor(obj) obj=Trim(obj); if(obj=null | obj=“) obj=“#000000“; LabelFontColor=obj;function SetLabelFontSize(obj) obj=Trim(obj); if(obj=null | obj=“) obj=“9pt“; LabelFontSize=obj;function SetLabelFontStyle(obj) obj=Trim(obj); if(obj=null | obj=“) obj=“Font.PLAIN“; LabelFontStyle=obj;function SetLabelBorderColor(obj) obj=Trim(obj); if(obj=null | obj=“) obj=“#000000“; LabelBorderColor=obj;function SetLabelBackColor(obj) obj=Trim(obj); if(obj=null | obj=“) obj=“#FFFFE1“; LabelBackColor=obj;/合成文字样式function SetTextStyle(str) var strRet=“; var strStyle=“; strStyle=“font-family:“+LabelFontFace+“;“; strStyle+=“color:“+LabelFontColor+“;“; strStyle+=“font-size:“+LabelFontSize+“;“; switch(LabelFontStyle.toLowerCase() case “font.plain“: strStyle+=“font-weight: normal;“; strStyle+=“font-style: normal;“; break; case “font.bold“: strStyle+=“font-weight: bold;“; strStyle+=“font-style: normal;“; break; case “font.italic“: strStyle+=“font-weight: normal;“; strStyle+=“font-style: italic;“; break; case “font.italicbold“: case “font.bolditalic“: strStyle+=“font-weight: bold;“; strStyle+=“font-style: italic;“; break; default: strStyle+=“font-weight: bold;“; strStyle+=“font-style: italic;“; break; strRet=“font style=“+strStyle+“; strRet+=“ “+str+“ “; strRet+=“/font“; return strRet;/合成表格样式function SetTableStyle() var strRet=“; strRet+=“border-right: “+LabelBorderColor+“ 1px solid;“; strRet+=“border-top: “+LabelBorderColor+“ 1px solid;“; strRet+=“border-left: “+LabelBorderColor+“ 1px solid;“; strRet+=“border-bottom: “+LabelBorderColor+“ 1px solid;“; strRet+=“background-color:“+LabelBackColor; return strRet;/显示提示function ShowNote(str) var strHtml; strHtml=“; strHtml+=“table height=1px width=1px border=0cellspacing=0 cellpadding=0 style=“ + SetTableStyle() + “; strHtml+=“tr“; strHtml+=“td“+SetTextStyle(str)+“/td“; strHtml+=“/tr“; strHtml+=“/table“; if (document.all&document.readyState=“complete“) document.all.div_Note.innerHTML=strHtml; document.all.div_Note.style.pixelLeft=event.clientX+document.body.scrollLeft+10 document.all.div_Note.style.pixelTop=event.clientY+document.body.scrollTop+10 document.all.div_Note.style.visibility=“visible“ /隐藏提示function HideNote() if (document.all) document.all.div_Note.style.visibility=“hidden“; else if (document.layers) clearInterval(currentscroll) document.div_Note.visibility=“hidden“; /初始化function Init() window.document.write(“div id=“div_Note“ style=“VISIBILITY:hidden; POSITION:absolute; HEIGHT:13px;z-index:1“/div“);Init();/生成提示字符function ShowLabel(text,note,bclick) if(bclick!=null) return “a href=“#“ onMouseOver=“ShowNote(“ + note + “)“ onMouseOut=“HideNote()“ onClick=“javascriptoSomeThing(this);“ + text + “/a“; else return “a href=“#“ onMouseOver=“ShowNote(“ + note + “)“ onMouseOut=“HideNote()“ + text + “/a“; 测试页面:HTML HEAD titleCommon javascript/title script language=“javascript“ src=“./Common.js“/script script language=“javascript“ function CheckInt() iptResult.value=IsInt(iptTest.value,iptSign.value,iptZero.value); function CheckFloat() iptResult.value=IsFloat(iptTest.value,iptSign.value,iptZero.value); function CheckLetter() iptResult.value=IsEnLetter(iptTest.value,iptSign.value); document.write(ShowLabel(“TEST“,“Only a testing!“); document.write(“br“); /script meta http-equiv=“expires“ content=“0“ /HEAD body input type=text value=“ id=“iptTest“input type=button value=“IsEmpty“ onclick=“IsEmpty(iptTest);“ input type=button value=“CheckInt“ onclick=“CheckInt()“ br input type=text value=“ id=“iptSign“ NAME=“iptSign“input type=b

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论