天天看点

html提交参数到html

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 οnlοad="GetParam()">

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

</body>

</html>