欢迎光临
我们一直在努力

如何使用ASP制作类似安装向导的页面?-ASP教程,ASP应用

建站超值云服务器,限时71元/月

如何使用asp制作类似安装向导的页面?

面临的主要问题何在:

1。界面和一个windows wizard完全一样,有next和back按钮

2。用户可以使用back按钮回到以前的任何一步,并且能够改变以前任何一步中已经选择的内容

3。form必须记住所有填入的内容

4。不能够使用数据库

5。不能够使用sessions,防止如果sessiosn失效后用户的所有输入丢失,不幸的是,也不能够使用cookie

因为很多拥护经常关掉浏览器的cookie选项。

6。可移植性要好,因为它要适应安装步数不同时的情况

解决方案:

1。使用hidden变量传递参数

2。使用post方式,不使用get方式,因为这种方式受长度限制

3。每一个页面都必须有一个用来读取提交值的函数

4。每一个页面(除了第一个页面外)都必须要有一个hidden form 来向前一页传递参数

如果在你的页面中使用了checkboxes或则使用了radio buttons,请使用以下代码读数值:

<% for each item in request.form

if request.form(item).count then

for intloop = 1 to request.form(item).count

response.write "item = " & item & " index = " & intloop & "<br>"

next

else

response.write "item = " & item & "<br>"

end if

next

%>

在设计是,对checkboxes和radio采用了特殊的处理方法:

1。只有最新的数值才被考虑使用这两种方式保存

2。用户可以使用back来改变前面输入的数值,但必须要使用next提交后才能够生效

3。页面必须要能够应付一个页面有多个controls的情况

具体实现方法:

第n个页面应该有:

1。第一个form:它的action= page(n+1).asp和它底部必须有next按钮

2。第二个form:它的action= page(n-1).asp和back按钮

3。变量命名规则:举例:n_<page no> 后缀是控件类型.<input type = radio name = radio_p2>

是表示第二页的一个name是radio的东西

4。一个用来读取提交的函数

页面根据一个循环来判断当前的控件是属于哪一页的。

代码如下:

<%@language="vbscript %>

<html>

<head>

</head>

<body>

<!– next按钮模块编程开始 –>

<form action="page03.asp" method="post" >

<!————————————————————->

<!–读入函数开始 –>

<!————————————————————->

<%

pageno = "_p2"

for each item in request.form

whichpage = instr(1,cstr(item), pageno,1)

if ((request.form(item).count) and (whichpage = 0)) then

strcount = request.form(item).count

stritem = request.form(item)(strcount)

response.write "<input type=""hidden"" name=""" & item & """ value=""" & stritem & """>" &vbcrlf

elseif (not(request.form(item).count) and (whichpage = 0)) then

response.write "<input type=""hidden"" name=""" & item & """ value=""" & stritem & """>" &vbcrlf

end if

next

%>

<!————————————————————>

<1– 读入函数结束 –>

<!————————————————————>

<!– #include file = "check_uncheck.txt" –>

<%

function check_uncheck(ctrlname, ctrlvalue)

dim ctrlname_in

dim ctrlvalue_in

dim ctrlvalue_actual

dim outstr

ctrlvalue_in =""

ctrlname_in = ""

ctrlvalue_actual = ""

outstr = ""

ctrlname_in = ctrlname_in & ctrlname

ctrlvalue_in = ctrlvalue_in & ctrlvalue

if request.form(ctrlname_in).count then

strcount = request.form(ctrlname_in).count

ctrlvalue_actual = request.form(ctrlname_in)(strcount)

if ctrlvalue_actual = ctrlvalue_in then

outstr = "checked"

end if

else

ctrlvalue_actual = request.form(ctrlname_in)

if ctrlvalue_actual = ctrlvalue_in then

outstr = "checked"

end if

end if

check_uncheck = outstr

end function

%>

<!– back按钮模块开始 –>

<%

stritem1 = ""

stritem1a = ""

for each item1 in request.form

if request.form(item1).count then

strcount1 = request.form(item1).count

stritem1 = request.form(item1)(strcount1)

response.write "<input type=""hidden"" name=""" & item1 & """ value=""" & stritem1 & """>" &vbcrlf

strcount1 = ""

stritem1 = ""

else

stritem1a = request.form(item1)

response.write "<input type=""hidden"" name=""" & item1& """ value=""" & stritem1a & """>" &vbcrlf

end if

next

stritem1 = ""

stritem1a = ""

%>

转自: http://goaler.xicp.net/article/showarticle.asp?id=269

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 如何使用ASP制作类似安装向导的页面?-ASP教程,ASP应用
分享到: 更多 (0)

相关推荐

  • 暂无文章