作者kitleong (gogogo)
看板Web_Design
标题Re: [问题] Submit後input不变
时间Mon Oct 9 13:56:47 2006
※ 引述《DennisKao (dk)》之铭言:
: 目前想做一个功能:
: 画面上有许多checkbox与radio,在按下Submit送出资料後(ASP)
: 导回原来的网页时,可以留下刚才的输入(勾选的checkbox)
: 不知是要使用Session或Cookie来存放输入资料,再用JavaScript读取
: 亦或是还有更好的办法?
最简单是用asp导回原本那页就好,例如:
test.asp
<%
test_checkbox=request.form("test_checkbox")
test_radio=request.form("test_radio")
'如果要写入资料库之类可以加在下面:
'set conn=....
%>
<html>
<head>
<title>xxx</title>
</head>
<body>
<form action="test.asp" method="post">
<input name="test_checkbox" type="checkbox" <%if test_checkbox=true then
response.write "checked=""checked""%>>
<input name="test_radio" value="1" <%if test_radio=1 then
response.write "selected=""selected""%>>
<input name="test_radio" value="2" <%if test_radio=2 then
response.write "selected=""selected""%>>
<input type="submit" value="OK">
</form>
</body>
</html>
大约如此,改一下类似的就好,不然就是导回那页时加入 ?xxx=xxx之类的变数控制,
方法很多,看你想用那一种。
用session也可以,有空再聊
--
欢迎参观我的网站:
http://www.dcaid.com/
电脑/数位相机的介绍, 教学, 评测的网站, 慢慢成长中... ~ :)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.116.116