<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="" method="post" name="frm">
<label for="username">用户名:</label>
<input type="text" name="username" value="" id="username"></br>
<label for="password">密 码:</label>
<input type="password" name="password" value="" id="password"></br>
<input type="submit" name="submit" value="Login">
</form>
<script>
var frmobj=document.getElementsByName("frm");
var frmob=document.frm;
console.log(frmobj);
console.log(frmob);
</script>
</body>
</html>这里的document.getElementsByName("frm");和 var frmob=document.frm;打印出来的分别是NodeList [ form ]<form action="" method="post" name="frm">有什么区别?实际操作表单的时候用哪个?
添加回答
举报
0/150
提交
取消