怎样用js创建Form表单并提交

var f = document.createElement("form");
document.body.appendChild(f);
var i = document.createElement("input");
i.type = "hidden";
f.appendChild(i);
i.value = "5";
i.name = "price";
f.action = "aa.asp";
f.submit();
--------------------如何在两个html的网页间传递变量?--------
<!--第一个页面-->
<html>

<head>
<script>
var key;
function textcontent(x)
{
key=document.getElementById(x).value;
location.href="test.htm?"+key;
}
</script>
</head>

<body>
<input id=x value=""/>
<input type=button value="跳转到test.htm页面" onclick="javascript:textcontent('x');">
</body>

</html>

<!--第二个页面-->
<html>
<head>
<title>text.htm页面</title>
<script defer>
var url=window.document.location.search;
if(url!=null)
{
url=url.substring(1,url.length);
}
alert(url);
</script>
</head>
<body>

</body>
</html>
-------------怎么让用户不能输入"\"这个字符啊? ---------

对像标签里加入:onKeyDown="if(window.event.keyCode==220){return false;};"
如:<input type="text" name="textfield" onKeyDown="if(window.event.keyCode==220){return false;};">

onKeyDown="alert(event.keyCode);"
想知道哪个就按哪个

原文地址:https://www.cnblogs.com/goody9807/p/885255.html