在框架页内用FORM传递参数

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 binghuodao 的 blog

    在写asp程序时我们经常会在页面之间传递参数,当然有两种方法,一种是问号传递、querystring接收,另一种就是from传递、form接收。

    用form传递参数的好处是:参数隐含传递,别人无法通过查看文件属性来看到参数的值,比较适合于在页面之间传递口令等保密参数。

   
    框架页面也是我们经常用到的,当然在框架页面中可以用问号传递参数,如:
<frameset>
 <frame name="frame1" src="xxxx.asp?id=1...">
 <frame name="frame2">
 <noframes>
  <body>
  <p>此网页使用了框架,但您的浏览器不支持框架。</p>
  </body>
 </noframes>
</frameset>

    但是当用form来传递参数是却有一些是要注意的地方,否则无法实现。如:
<html>
<head>
<script language="vbscript">
<!--
option explicit

sub window_onload()
 frmvol.action = "volbutton.asp"
 frmvol.target = "button"
 frmvol.submit
end sub
-->
</script>
</head>
<form name="frmvol" id="frmvol" method="post">
 <input type="hidden" name="txtvolkeyword" id="txtvolkeyword" value="<%=request.form("txtvolkeyword")%>">
</form>
<frameset rows="29,*,0,0,0" border=0 name="volframe">
 <frame name="button" id="button">
 <frame name="vol">
 <frame name="file">
 <frame name="fileinfo">
 <frame name="execute">
 
 <noframes>
  <body>
  <p>此网页使用了框架,但您的浏览器不支持框架。</p>
  </body>
 </noframes>
</frameset>
</html>
    注意:1.<script>和<form>标记要写在<frameset>标记之前
          2.action、target属性要在脚本中设置,不要直接在<form>标记中写。
          3.<frame>标记中不要写src属性,否则框架会直接以问号方式调用src页面。

 

本文关键:框架、FORM、参数
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top