<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>表单选择器</title>
</head>
<body>
<form action="">
姓名:<input type="text">
密码:<input type="password">
</form>
<script>
var form=document.getElementsByTagName('form')[0]
console.log(form)
// form.setAttribute('style','background:red');
form.style.background="green"
</script>
</body>
</html>