利用js来简单的实现表单里的按钮【获取表单内的数据】和【设置数据到表单内】操作
页面效果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a3547356a7a14af82d8ea52af9886178.png)
html页面 0316Web/WebRoot/html/htmlDay01.html
<!DOCTYPE html>
<html>
<head>
<title>htmlDay01.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../css/htmlDay01.css">
<script type="text/javascript" src="../js/htmlDay01.js"></script>
</head>
<body>
<!--导航条-->
<div id="header">
<nav id="nav_whole">
<ul>
<li><a href="HOME">Link one</a></li>
<li><a href="NEWS">Link two</a></li>
<li><a href="CONTACT">Link three</a></li>
<li><a href="ABOUT">Link four</a></li>
</ul>
</nav>
<!--表单-->
</div>
<div id="form">
<form action="" method="post">
<div>
<label>请输入ID:</label>
<input type="text" id="id" >
</div>
<br>
<div>
<label>请输入姓名:</label>
<input type="text" id="name">
</div>
<br>
<div>
<label>请输入性别:</label>
<input type="radio" name="sex" value="男">男
<input type="radio" name="sex" checked="checked" value="