谁能分析这段代码?请高手!

lihangpp 2005-04-02 10:59:58
我在网上看到这段代码,我想问下如果我现在在文件3点击保存按钮怎么能把文件3中文本框的内容保存到数据库中,请高手详细指教
文件名称分别是:
main.asp
top.asp
mid.asp
bot.asp
深下的就不用说了吧。
------------------------文件1------------------------------
<html>
<head>
<title>主窗体</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<frameset rows="*,120,80" frameborder="YES" border="1" framespacing="1" cols="*" bordercolor="#009999">
<frame name="topFrame" scrolling="NO" noresize src="top.asp" >
<frame name="midFrame" src="mid.asp" noresize scrolling="NO">
<frame name="botFrame" scrolling="NO" noresize src="bot.asp">
</frameset>
<noframes><body bgcolor="#FFFFFF" text="#000000">
</body></noframes>
</html>
-------------------------文件2-----------------------
<html>
<head>
<title>试题窗体</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=vbscript>
sub change_value()
parent.midFrame.shuaxin()
end sub
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form id=form1 name="form1" method="post" action="">
<table width="700" border="0" cellpadding="0" cellspacing="3">
<tr>
<td width="111" bgcolor="#66CC99">单选题1:</td>
<td bgcolor="#66CC99">
<input type="radio" name="q1" value="1" checked onclick=change_value()>
答案1
<input type="radio" name="q1" value="2" onclick=change_value()>
答案2
<input type="radio" name="q1" value="3" onclick=change_value()>
答案3
<input type="radio" name="q1" value="4" onclick=change_value()>
答案4</td>
</tr>
<tr>
<td width="111">单选题2:</td>
<td>
<input type="radio" name="q2" value="1" checked onclick=change_value()>
答案1
<input type="radio" name="q2" value="2" onclick=change_value()>
答案2
<input type="radio" name="q2" value="3" onclick=change_value()>
答案3
<input type="radio" name="q2" value="4" onclick=change_value()>
答案4</td>
</tr>
<tr>
<td width="111" bgcolor="#66CC99">多选题3:</td>
<td bgcolor="#66CC99">
<p>
<input type="checkbox" name="q3" value="1" onclick=change_value()>
答案1
<input type="checkbox" name="q3" value="2" onclick=change_value()>
答案2
<input type="checkbox" name="q3" value="3" onclick=change_value()>
答案3
<input type="checkbox" name="q3" value="4" onclick=change_value()>
答案4</p>
</td>
</tr>
<tr>
<td width="111">填空题4:</td>
<td>
<p>请输入答案
<input type="text" name="q4" value="haha" onchange=change_value()>
</p>
</td>
</tr>
<tr>
<td width="111"> </td>
<td>
<input type="submit" name="Sub_ok" value="交卷">
</td>
</tr>
</table>
</form>
</body>
</html>
--------------------文件3-------------------------
<html>
<head>
<title>试题答案保存窗体</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=vbscript>
sub shuaxin()
dim TStr
if parent.topFrame.document.form1.q1(0).checked then document.form1.a1.value=1
if parent.topFrame.document.form1.q1(1).checked then document.form1.a1.value=2
if parent.topFrame.document.form1.q1(2).checked then document.form1.a1.value=3
if parent.topFrame.document.form1.q1(3).checked then document.form1.a1.value=4
'获得第一个按钮
if parent.topFrame.document.form1.q2(0).checked then document.form1.a2.value=1
if parent.topFrame.document.form1.q2(1).checked then document.form1.a2.value=2
if parent.topFrame.document.form1.q2(2).checked then document.form1.a2.value=3
if parent.topFrame.document.form1.q2(3).checked then document.form1.a2.value=4
'获得第二个按钮
TStr=""
if parent.topFrame.document.form1.q3(0).checked then TStr="1"
if parent.topFrame.document.form1.q3(1).checked then
if Tstr="" then
TStr="2"
else
TStr=TStr&",2"
end if
end if
if parent.topFrame.document.form1.q3(2).checked then
if Tstr="" then
TStr="3"
else
TStr=TStr&",3"
end if
end if
if parent.topFrame.document.form1.q3(3).checked then
if Tstr="" then
TStr="4"
else
TStr=TStr&",4"
end if
end if
document.form1.a3.value=TStr
document.form1.a4.value=parent.topFrame.document.form1.q4.value
end sub
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" onload=shuaxin()>

<form name="form1" method="post" action="">
<table width="600" border="1" align="center">
<tr>
<td colspan="3"> 1、
<input type="text" name="a1" readonly>
2、
<input type="text" name="a2" readonly>
<br>
3、
<input type="text" name="a3" readonly>
4、
<input type="text" name="a4" readonly>
(只读属性)</td>
</tr>
<tr>
<td colspan="3">说明:该页面用隐藏的输入框保存主页面的值。</td>
</tr>
<tr>
<td width="193"> </td>
<td width="69">
<input type="submit" name="Sub_ok" value="保存">
</td>
<td width="316">注:该页面的按钮不需要点击</td>
</tr>
</table>
</form>
</body>
</html>
-----------------------文件4----------------------------
<html>
<head>
<title>自动刷新</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=vbscript>
sub shuaxin()
parent.midFrame.document.form1.sub_ok.click
end sub
</script>
<meta http-equiv="refresh" content="60;URL=bon.asp">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<A href=# onclick=shuaxin()>自动刷新页面</a> (60秒刷新一次)
</body>
</html>
...全文
96 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jgj5346176 2005-04-02
  • 打赏
  • 举报
回复
这个好像比较简单嘛
lihangpp 2005-04-02
  • 打赏
  • 举报
回复
大哥,拜托说多一遍也不麻烦吧,谢了
jarraytan 2005-04-02
  • 打赏
  • 举报
回复
这个好像已经问过一次了吧??? -_-
shenlan198263 2005-04-02
  • 打赏
  • 举报
回复
我晕。。搞笑呀。怎么都乱套的?
huangleibo 2005-04-02
  • 打赏
  • 举报
回复
抱歉,不敢看了。
wangyingdong 2005-04-02
  • 打赏
  • 举报
回复
太长了

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧