日期:2014-05-16  浏览次数:20356 次

如何把在javascrip中定义的值用POST传给下一页面
如,我在脚本中定义了下面的变量
<script>
var   a=32;
</script>
我怎么把这个值用POST方式传给另一个ASP页面?使得在ASP页面中可以用REQUEST.FORM来取得其值.

------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<html>
<head>
<title> New Document </title>
<meta name= "Generator " content= "EditPlus ">
<meta name= "Author " content= " ">
<meta name= "Keywords " content= " ">
<meta name= "Description " content= " ">
<script language= "JavaScript " src= "prototype.js "> </script>
</head>

<body>
<form method= "POST " action= "npage.asp " id= "form1 " name= "form1 ">
<input type= "hidden " name= "aa ">
</form>

<script language= "JavaScript ">
<!--
strhidden = document.createElement( "input ");
strhidden.type= "hidden ";
strhidden.id= "strpost ";
document.forms( "form1 ").appendChild(strhidden);
$( "strpost ").value= "aaaaaaaaaa ";


alert(window.document.body.innerHTML);

</script>

</body>
</html>