操作表单
表单的作用:提交信息
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="post">
<p><span>用户名:</span> <input type="text" id="username"></p>
<p>
<span>性别:</span>
<input type="radio" name="sex" value="man" id="boy">男
<input type="radio" name="sex" value="women" id="girl">女
</p>
</form>
<script>
var text=document.getElementById('username');
var boy=document.getElementById('boy');
var girl=document.getElementById('girl');
//得到输入框的值
text.value;
//修改输入框的值
text.value='xixihaha';
//对于单选框多选框等等固定的值 只能查看是否选中 为true选中 false就没选中
//boy.checked;
girl.checked=true;
//girl.checked=false;
</script>
</body>
</html>