错误行:document.write(d.elements[i].name);
只输出了textfield,然后就提示说没有权限 纳闷<html>
<head>
<script type="text/javascript">
function op() {
var d = document.getElementById("form1");
var l = d.length;
for(var i = 0; i < l-1; i++) {
document.write(d.elements[i].name);
}
//document.write(d.elements[2].name);
}
</script>
</head>
<body>
<form name="form1" action="3.html" method="post"> <input type="text" name="textfield" id="textfield">
<input type="text" name="textfield2" id="textfield2"> <input type="text" name="textfield3" id="textfield3"> <input type="text" name="textfield4" id="textfield4"> <input type="submit" name="button" id="button" value="提交" onclick="op()"></form>
</body></html>
只输出了textfield,然后就提示说没有权限 纳闷<html>
<head>
<script type="text/javascript">
function op() {
var d = document.getElementById("form1");
var l = d.length;
for(var i = 0; i < l-1; i++) {
document.write(d.elements[i].name);
}
//document.write(d.elements[2].name);
}
</script>
</head>
<body>
<form name="form1" action="3.html" method="post"> <input type="text" name="textfield" id="textfield">
<input type="text" name="textfield2" id="textfield2"> <input type="text" name="textfield3" id="textfield3"> <input type="text" name="textfield4" id="textfield4"> <input type="submit" name="button" id="button" value="提交" onclick="op()"></form>
</body></html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货