第一个网页的HTML代码为:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表单</title></head>
<form name="myform" method="get" action="next.html">
姓名:<input type="text" name="username" /><br />
    性别:<input type="radio" name="sex" value="男" />男&nbsp;&nbsp;
    <input type="radio" name="sex" value="女" />女<br />
    <input type="submit" name="submit" value="提交" />&nbsp;
    <input type="reset" name="reset" value="重置" /><br />
</form>
<body>
</body>
</html>接收表单信息的网页代码为:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>接收用户数据</title>
<script type="text/javascript" language="javascript">
var currenturlsearch=location.search;
currenturlsearch=currenturlsearch.substring(1);
var arr=currenturlsearch.split("&");
if(arr.length<2)
{
alert("输入信息不完整!请重新输入!");
history.back();
}
arrname=arr[0].split("=");
document.write(arrname[1]+"<br/>");
arrsex=arr[1].split("=");
document.write(arrsex[1]);
</script>
</head><body>
<form name="myform">
<input type="button" value="后退" onclick="history.back()" />
    <input type="button" value="前进" onclick="history.forward()" />
    直接跳转到第<input type="text" name="gos" value="-1" size="3" />页<input type="button" value="确定" onclick="history.go(myform.gos.value)" />
</form>
</body>
</html>
大家帮着解决下吧,难道是表单提交后已经加密了?

解决方案 »

  1.   

    如果提交的内容保存在了a变量里用encodeURIComponent(a)作为要传递的内容  然后在接收的页面decodeURIComponent()下试试 不知行不行
      

  2.   

    类似于这样
    <script type="text/javascript">
    function ss(){
    window.location.href="a.html?name="+encodeURIComponent(document.forms[0].elements[0].value);
    }
    </script>
    </head><body>
    <form>
    <input type="text"><input type="button" onclick="ss()">
    </form>
    </body>
    a页面则可以
    <script type="text/javascript">
    function init(){
    var a=window.location.search;
    a=a.substring(1,a.length);
    alert(decodeURIComponent(a));
    }
    </script>
    </head><body onload="init()">
    </body>试试