html提交参数到html

来源:互联网 发布:淘宝问卷调查模板 编辑:程序博客网 时间:2024/05/14 04:16
aa.html 提交参数到 view.html
aa.html代码如下:
<html>
<head>
<title></title>
</head>
<body>
<form id="aa" action="./view.html" method="get">
<input type="text" id="result" name="result" value="12"/>
<input type="submit" id="submit" value="submit"/>
</form>
</body>
</html>


view.html代码如下:

<html>
<head>
<title></title>
</head>
<script type="text/javascript">

function GetParam(){
var path=window.location.href;
var pos=path.indexOf("=");
var parm;
if(pos > 0){
       parm=path.substring(pos+1,path.length);
}
document.getElementById('result').value=parm;
return parm;
}
</script>
<body onload="GetParam()">

<input type="text" id="result" name="result" />

</body>
</html>
原创粉丝点击