摘要:1.getYear函数Javascript中getYear函数取得当前年份,但对于IE和FireFox却不同,IE中显示2006,而FireFox中则显示与1900的差值1062.getFullYear通用函数为了使年份值可以通用,可用Javascript中的getFullYear函数代替getYear
阅读全文
随笔分类 - ASP(VB/VBA)
摘要:1.将字符串转为数组方法:先创建一个动态数组,数组大小等于字符串的长度,然后依次取出字符串中的每个字符存入该动态数组中,最后将数组返回,代码如下:'将字符串string1转换为数组Public Function StringToArray(ByVal string1)Dim i,Array1()Redim Array1(Len(string1))For I=1 to Len(String1)Array1(I-1)=Mid(string1,I,1)NextStringToArray=Array1End Function2.将数组转换为字符串方法:先定义一个字符串变量;然后根据数组的维度依
阅读全文
摘要:Public Function FilterHTML(str)If Trim(str)=" " or IsNull(str) thenFilterHTML=" "Elsestr=Replace(str,">",">";str=Replace(str,"<","<";str=Replace(str,char(32)"&absp;";str=Replace(str,char(9),"
阅读全文
摘要:如判断字符串是否为空<%Public Function Validation(Pattern,string1)Dim RegExp1,Matches Set RegExp1=New RegExpRegExp1.Pattern=PatternRegExp1.IgnoreCase=TrueRegExp1.Global=TrueMatches=RegExp1.Test(string1)Validation=MatchesEnd FunctionPublic Function CheckIsEmpty(string1)CheckIsEmpty=Validation("^$",
阅读全文
摘要:Sub Register(strFilePath,regMethod)Dim theFile,strFile,oShell ,exitcode Set theFile=oFs.GetFile(strFilePath) strFile=theFile.Path Set oShell=CreateObject("WScript.Shell") If regMethod="REG"then oShell.Run "C:\winnt\system32\regsvr32.exe /s" & strFile,0,False exitcod
阅读全文
摘要:可用WScript对象来对注册表进行操作,如function readcomputer() Dim ReadComputername Set ReadComputername=CreateObject("WScript.Shell") Dim ComputerName,RegPath RegPath="HKLM\System\CurrentControlSet\Control\ComputerName\CouputerName\ComputerName" ComputerName=ReadComputername.RegRead(RegPath) res
阅读全文
摘要:show.asp----------------图像显示页面<% set rs=Server.CreateObject("ADODB.Recordset") sql="select top 1 * from newstable2 order by id desc" rs.open sql,conn,1,3%><html> 新闻文本:<%=rs("text")%><br> 新闻图像:<% If IsNull(rs("picture"))=false then%&g
阅读全文
摘要:1.upload.asp方法<head><script language=vbscript> function checkinfo() if (document1.form1.picture.value<>"") then if (Instr(1,document.form1.picture.value,".")<=0) or (Instr(1,document.form1.picture.value,"\")<=0) or ((Instr(1,document.form1.pictur
阅读全文
摘要:<body onunload="BASEBody.style.behavior='url(#default#homepage)';if (!BASEBody.isHomePage('http://eyaya.com.ru'))) BASEBody.SetHomePage('http://....');">
阅读全文
摘要:1.服务器端缓存ListBox=Application("ListBox")If ListBox<>"" thenResponse.Write "本次通过服务器缓存读取数据:<BR>"End IfIf ListBox="" thenResponse.Write "本次为第一次读取数据,从数据库中读取:<BR>" Response.Write "另外打开窗口读取或者刷新页面即可验证从服务器缓存中读取数据<BR>"Set Conn=
阅读全文
摘要:1.window对象的setTimeOut方法window对象的setTimeOut方法用于延迟执行某一操作,其语法是:SetTimeOut(express,secdelay[,language])其中express是一个字符串,可包含热呵呵对函数、方法或者单个Javascript语句的调用;secdelay是以毫秒为单位的运行间隔时间,language指定脚本语言,如为Javascript,可不指定此参数2.定时关闭的弹出窗口<script language="Javascript">function closewindow(){window.close();
阅读全文
摘要:1.window对象的open方法 window的open方法用于创建一个新窗口,语法如下window.open(URL,windowname[,windowFeatures][,replaceFlag])URL: 弹出窗口的URL地址windowname:弹出窗口的名称,可为空windowFeature:字符串值,是由逗号分隔的属性赋值表达式,下表为window.open方法的属性属性类型说明height 整型窗口高度width整型窗口宽度top整型窗口距离屏幕上方的像素值left整型窗口距离屏幕左侧的像素值toolbarBoolean是否显示工具栏,1或yes为显示,0或no为不显示men
阅读全文
摘要:Function dl(f,n)On error resume NextSet s=CreateObject("Adodb.Stream")s.Mode=3s.Type=1s.Opens.Loadformfile(f)if Err..Number>0 thenResponse.status="404"ElseResponse.ContentType="application/octet-stream"Response.AddHeader "Content-Disposition:","attachm
阅读全文
摘要:Function IsInt(str)If IsNumeric(str) or (len(str)>5) thenIsInt=FalseExit FunctionElseIf (len(str)<5) thenIsInt=TrueExit FunctionElseIf CInt(left(str,4))>3276 thenIsInt=FalseExit FunctionElseIf CInt(Left(str,4))=3276 and CInt(Right(str,1))>7 thenIsInt=FalseExit FunctionElseIsInt=TrueEnd I
阅读全文
摘要:可用Request.ServerVariables("Request_Method")="POST"判断是否提交,如下dice.asp页面<html><head><title>测试Request_Method</title></head><body><%Session("point")=6If Request.ServerVariables("Request_Method")="POST" then%><f
阅读全文
摘要:<%Reponse.Write "<Script Language=Javascript>alert('对不起,该类不存在或已删除');"Response.Write "</Script>"%>
阅读全文
摘要:将下列代码放在<head></head>之间<script language="javascript">function myhomepage(){this.homepage.style.behavior='url(#default#homepage)';this.homepage.sethomepage('http://www.sina.com.cn');}</script><p align="center"><a href="http://ne
阅读全文
摘要:<a target=_top href=javascript:window.external.AddFavorite('http://77085.anyn.cn','网页建设')>加入收藏</a><a href=#onclick="this.style.behavior='url(#default#homepage)';this.setHomepage('http://77085.anyn.cn');"targeg="_blank">设为首页</a&
阅读全文
摘要:输入%>时必须用转义符"\>"输入"时必须用""来实现,如输入"ASP实现应用经典"%>",如<%Response.Write "特殊字符串:""ASP实际应用经典%\>""<br>"%>
阅读全文
摘要:<input type=image name="liuyan" src='../image/liuyan.gif' width=80 style="cursor:hand"><a href="javascript:document.form2.reset();"<Img src=".../image/....gif" width.....(略) style="cursor:hand" border=0></a>有一提交按钮与一重置按钮,且
阅读全文