<form>元素代表了表单,继承了 HTMLFormElement 接口。
<form>
elements
length
name
method
target
action
enctype
encoding
application/x-www-form-urlencoded
multipart/form-data
text/plain
acceptCharset
autocomplete
on
off
<input>
noValidate
submit()
submit
reset()
checkValidity()
true
false
invalid
下面是一个创建表单并提交的例子。
var f = document.createElement('form'); document.body.appendChild(f); f.action = '/cgi-bin/some.cgi'; f.method = 'POST'; f.submit();