1、你刚才输入的编号是:txt2/form/body/html方法二:(同方法一,修改部分见下)2、命令按钮及文字的点击事件(body部分)input type=点击警告 onclick=vbscript:window.alert(请注意哟!)点击关闭window.close() font onclick= 【关闭】font color=blueVBScript dim s function g(s) if s= then alert(你好,姓名不能为空,请重新输入) s= end if end functionform id= name=输入你的姓名:xm onblur=g(xm.va
2、lue) /5、打开页面和关闭页面时触发的事件过程body onload=alert(欢迎你到这里来!) onunload=再见,欢迎你再到这里来!a href=b4-5.asp在另一个窗口打开此文件6、单击鼠标时触发的事件过程 function c1(s) dim d d=s你的地址为:d)body bgcolor=lightsteelblue请输入你的地址:entry size=50/dz提交 onclick=c1(entry.value)7、移动鼠标时触发的事件过程 function c1(您的鼠标正在进行移动操作 function c2() window.status=提示: wind
3、ow.settimeout c3(),1000 window.settimeout的用法是window.settimeout 过程名,时间 其中时间是以毫秒计,默认3000 function c3() end function onmouseover=c1()鼠标正在进行移动操作 onmousemove=c2()点击此处可以查看状态栏的信息8、正在进行的动作改变时触发事件过程 dim s,y if s then window.alert(您正在进行修改操作 window.confirm(您想继续吗? end if function c2(y) if y5 then 您正在进行修改操作% for
4、 i=1 to 7 %font size= 您好! 欢迎您学习ASP技术br%next%10、加法运算(1)form action=5-2-2.aspForm1 aNumberA + (“+”单独一行)NumberBsubmitSubmit相加10、加法运算(2)%a=request.Form(b=request.Form(if a and b11、运算结果a=Cdbl(request.Form()b=Cdbl(request.Form(c=a+bresponse.Write(c)12、URL传递参数(1)A HREF=5-2-5.asp?UserName=Conquer&UserSex=男用
5、户信息12、URL传递参数(2)Uname=Request.QueryString(UserNameUsex=Request.QueryString(UserSexResponse.Write(用户姓名为:Uname)用户性别为:Usex)13、服务器端变量SIP=Request.ServerVariables(LOCAL_ADDRSName=Request.ServerVariables(SERVER_NAMESPort=Request.ServerVariables(SERVER_PORTCIP=Request.ServerVariables(REMOTE_ADDRCMethod=Requ
6、est.ServerVariables(REQUEST_METHOD服务器IP:SIP)服务器名称:SName)服务器端口:SPort)客户机IP:CIP)请求方法:Cmethod)14、登录事例if Request.ServerVariables()=POST Uname=Request.Form( Upass=Request.Form(UserPass Utype=Request.Form(UserType if Utype=Teacher if Uname=conquer and Upass= Response.Write(欢迎您,uname) else Response.Write(账
7、号密码错误 end if elsestudent15、转向语句 Then Response.Redirect(5-2-8.asp elseif Uname=5-2-9.asp账号或密码错误 End ifEnd if16、终止网页处理语句欢迎访问我的网站现在时间为:now()Response.End()欢迎下次再来本站站长Conquer17、清除缓冲区语句Response.Clear()18、Response事例你的账号为:Uname )你的密码为:Upass) Response.End() Else5-3-7.asp账号: 密码:passwordresetSubmit2重置19、单值Cooki
8、e事例Response.Cookies(UsernameConquerUserAge)=20).expires=#2010-1-1#20、读Cookie事例Uname=Request.Cookies(Uage=Request.Cookies(你的姓名为:UName) )你的年龄为:Uage)21、Cookie综合事例 Then UName=Request.Form() 接收用户新输入的姓名 Cname=Request.Cookies(User)(LoginName接收存在Cookie中的姓名 Ccount=Request.Cookies(LoginCount接收存在Cookie中的访问次数 C
9、time=Request.Cookies(LoginTime接收存在Cookie中的访问时间 If Cname= Then 如果用户第一次访问本站 Ccount=0这是您第1次访问本站 Else 如果用户多次访问本站 if Cname=Uname Then 如果用户本次输入姓名和Cookie中的姓名一致欢迎您再次访问本站Uname &您上次访问本站时间为:Ctime & else 如果用户本次输入姓名和Cookie中的姓名不一致您上次访问本站的姓名为:Cname &您本次访问本站的姓名为: End if 该计算机共访问本站:Ccount+1 &次 不管第几次访问都直接向Cookie里写入新内容 Response.Cookies()=Uname)=Cint(Ccount)+1) =now().Expires=#2010-1-1# 姓名:登陆22、登录事例table width=300 border=1 align=center cellpadding=2 cellspacing=tr align= bgcolor=#0099FFtd colspan=span class=style1用户登陆/td/trtr bgcolor=#CCFFFFtd width=20%80%td密码:类型:labelradio 教师Student 学生mlq
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1