ASP代码2.docx

上传人:b****6 文档编号:7089264 上传时间:2023-01-17 格式:DOCX 页数:14 大小:17.82KB
下载 相关 举报
ASP代码2.docx_第1页
第1页 / 共14页
ASP代码2.docx_第2页
第2页 / 共14页
ASP代码2.docx_第3页
第3页 / 共14页
ASP代码2.docx_第4页
第4页 / 共14页
ASP代码2.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

ASP代码2.docx

《ASP代码2.docx》由会员分享,可在线阅读,更多相关《ASP代码2.docx(14页珍藏版)》请在冰豆网上搜索。

ASP代码2.docx

ASP代码2

1、复制功能(二种方法)

方法一:

无标题文档

--

subcom1_onclick

form1.txt2.value=form1.txt1.value

endsub

-->

请输入一个编号:

你刚才输入的编号是:

方法二:

(同方法一,修改部分见下)

--

subcom1_onclick

form1.txt2.value=form1.txt1.value

endsub

-->

2、命令按钮及文字的点击事件(body部分)

window.alert("请注意哟!

")'>

window.close()'>

 

    

window.close()'>【关闭】

3、asmilingface

^_^"onclick='javascript:

(this.value=="Asmilingface:

^_^")?

(this.value="Acryingface:

^o^"):

(this.value="Asmilingface:

^_^");'>

4、文本框失去鼠标时触发的事件过程onblur事件

dims

functiong(s)

ifs=""then

alert("你好,姓名不能为空,请重新输入")

s=""

endif

endfunction

输入你的姓名:

5、打开页面和关闭页面时触发的事件过程

')"onunload="alert('再见,欢迎你再到这里来!

')">

在另一个窗口打开此文件

6、单击鼠标时触发的事件过程

dims

functionc1(s)

dimd

d=s

alert("你的地址为:

"&d)

endfunction

请输入你的地址:

7、移动鼠标时触发的事件过程

functionc1(

alert("您的鼠标正在进行移动操作")

endfunction

functionc2()

window.status="提示:

您的鼠标正在进行移动操作"

window.settimeout"c3()",1000'window.settimeout的用法是window.settimeout"过程名",时间其中时间是以毫秒计,默认3000

endfunction

functionc3()

window.status=""

endfunction

鼠标正在进行移动操作

点击此处可以查看状态栏的信息

8、正在进行的动作改变时触发事件过程

dims,y

functionc1(s)

ifs<>""then

window.alert("您正在进行修改操作")

window.confirm("您想继续吗?

")

endif

endfunction

functionc2(y)

ify<5then

window.alert("您正在进行修改操作<5,请输入20以上")

endif

endfunction

请输入你的姓名:

请输入您的年龄:

 

9、分行排列字号依次增大的字

<%fori=1to7%>

>

您好!

欢迎您学习ASP技术


<%next%>

10、加法运算

(1)

a

+(“+”单独一行)

10、加法运算

(2)

a

+(“+”单独一行)

<%

a=request.Form("NumberA")

b=request.Form("NumberB")

ifa<>""andb<>""then

c=cdbl(a)+cdbl(b)

response.Write(a&"+"&b&"="&c)

endif

%>

11、运算结果

<%

a=Cdbl(request.Form("NumberA"))

b=Cdbl(request.Form("NumberB"))

c=a+b

response.Write(c)

%>

12、URL传递参数

(1)

UserName=Conquer&UserSex=男>用户信息

12、URL传递参数

(2)

<%

Uname=Request.QueryString("UserName")

Usex=Request.QueryString("UserSex")

Response.Write("用户姓名为:

"&Uname)

Response.Write("
")

Response.Write("用户性别为:

"&Usex)

%>

13、服务器端变量

<%

SIP=Request.ServerVariables("LOCAL_ADDR")

SName=Request.ServerVariables("SERVER_NAME")

SPort=Request.ServerVariables("SERVER_PORT")

CIP=Request.ServerVariables("REMOTE_ADDR")

CMethod=Request.ServerVariables("REQUEST_METHOD")

Response.Write("服务器IP:

"&SIP)

Response.Write("
")

Response.Write("服务器名称:

"&SName)

Response.Write("
")

Response.Write("服务器端口:

"&SPort)

Response.Write("
")

Response.Write("客户机IP:

"&CIP)

Response.Write("
")

Response.Write("请求方法:

"&Cmethod)

%>

14、登录事例

<%

ifRequest.ServerVariables("REQUEST_METHOD")="POST"then

Uname=Request.Form("UserName")

Upass=Request.Form("UserPass")

Utype=Request.Form("UserType")

ifUtype="Teacher"then

ifUname="conquer"andUpass="conquer"then

Response.Write("欢迎您,"&uname)

else

Response.Write("账号密码错误")

endif

else

ifUname="student"andUpass="student"then

Response.Write("欢迎您,"&uname)

else

Response.Write("账号密码错误")

endif

endif

endif

%>

15、转向语句

<%

ifRequest.ServerVariables("REQUEST_METHOD")="POST"Then

Uname=Request.Form("UserName")

Upass=Request.Form("UserPass")

ifUname="conquer"andUpass="conquer"Then

Response.Redirect("5-2-8.asp")

elseifUname="student"andUpass="student"Then

Response.Redirect("5-2-9.asp")

else

Response.Write("账号或密码错误")

Endif

Endif

%>

16、终止网页处理语句

欢迎访问我的网站

<%

Response.Write("现在时间为:

"&now())

Response.End()

Response.Write("欢迎下次再来")

%>

本站站长Conquer

17、清除缓冲区语句

<%

Response.Write("现在时间为:

"&now())

Response.Clear()

Response.Write("欢迎下次再来")

Response.Write("
")

%>

本站站长Conquer

18、Response事例

<%

ifRequest.ServerVariables("REQUEST_METHOD")="POST"Then

Uname=Request.Form("UserName")

Upass=Request.Form("UserPass")

ifUname="conquer"andUpass="conquer"then

Response.Write("你的账号为:

"&Uname)

Response.Write("
")

Response.Write("你的密码为:

"&Upass)

Response.End()

Else

Response.Redirect("5-3-7.asp")

Endif

Endif

%>

账号:


密码:


19、单值Cookie事例

<%

Response.Cookies("Username")="Conquer"

Response.Cookies("UserAge")=20

Response.Cookies("Username").expires=#2010-1-1#

Response.Cookies("UserAge").expires=#2010-1-1#

%>

20、读Cookie事例

<%

Uname=Request.Cookies("Username")

Uage=Request.Cookies("UserAge")

Response.Write("你的姓名为:

"&UName)

Response.Write("
")

Response.Write("你的年龄为:

"&Uage)

%>

21、Cookie综合事例

<%

ifRequest.ServerVariables("REQUEST_METHOD")="POST"Then

UName=Request.Form("UserName")'接收用户新输入的姓名

Cname=Request.Cookies("User")("LoginName")'接收存在Cookie中的姓名

Ccount=Request.Cookies("User")("LoginCount")'接收存在Cookie中的访问次数

Ctime=Request.Cookies("User")("LoginTime")'接收存在Cookie中的访问时间

IfCname=""Then'如果用户第一次访问本站

Ccount=0

Response.Write("这是您第1次访问本站")

Else'如果用户多次访问本站

ifCname=UnameThen'如果用户本次输入姓名和Cookie中的姓名一致

Response.Write("欢迎您再次访问本站"&Uname&"
")

Response.Write("您上次访问本站时间为:

"&Ctime&"
")

else'如果用户本次输入姓名和Cookie中的姓名不一致

Response.Write("您上次访问本站的姓名为:

"&Cname&"
")

Response.Write("您上次访问本站时间为:

"&Ctime&"
")

Response.Write("您本次访问本站的姓名为:

"&Uname&"
")

Endif

Response.Write("该计算机共访问本站:

"&Ccount+1&"次
")

Endif

'不管第几次访问都直接向Cookie里写入新内容

Response.Cookies("User")("LoginName")=Uname

Response.Cookies("User")("LoginCount")=Cint(Ccount)+1

Response.Cookies("User")("LoginTime")=now()

Response.Cookies("User").Expires=#2010-1-1#

Endif

%>

姓名:

22、登录事例

用户登陆

账号:

密码:

类型:

教师

学生


<%

ifRequest.ServerVariables("REQUEST_METHOD")="POST"then

Uname=Request.Form("UserName")

Upass=Request.Form("UserPass")

Utype=Request.Form("UserType")

ifUtype="Teacher"then

ifUname="mlq"andUpass="mlq"then

Response.Write("欢迎您,"&uname)

else

Response.Write("账号密码错误")

endif

else

ifUname="student"andUpass="student"then

Response.Write("欢迎您,"&uname)

else

Response.Write("账号密码错误")

endif

endif

endif

%>

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 其它模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1