【发布时间】:2013-09-27 02:15:57
【问题描述】:
我想知道是否有任何方法(使用 JS 或其他方式)来自动提交一个表单,其中一个字段的名称和 ID 为“提交”。本质上,我的整个 HTML 代码如下所示:
<html>
<body onload=myForm.submit()>
<form id="myForm" name="myForm" action="http://example.com/examplePage.do" method="POST">
<input type=hidden name="val1" id="val1" value="some_Value"/>
<input type=hidden name="val2" id="val2" value="another_Value"/>
<input type=hidden name="val3" id="val3" value="yet_another_Value"/>
<input type=hidden name="submit" id="submit" value="Continue"/>
</form>
</body>
</html>
显然,myForm.submit() 返回 myForm.submit is not a function 错误。如果没有值为“Continue”的“submit”字段,服务器将拒绝该请求,并且要求是自动提交。
【问题讨论】:
标签: javascript html form-submit csrf poc