10.表单语法


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录注册</title>
</head>
<body>
<h1>注册</h1>
<form action="1.我的第一个网页.html" method="post">
<p>名字:<input type="text" name="username"></p>
<p>密码:<input type="password" name="pwd"></p>
<p>性别:
<input type="radio" value="boy"name="sex"/>男
<input type="radio" value="girl"name="sex" checked/>女
</p>
<p>爱好:
<input type="checkbox" value="sleep"name="hobby">睡觉
<input type="checkbox" value="code"name="hobby" checked>敲代码
<input type="checkbox" value="chat"name="hobby">聊天
<input type="checkbox" value="game"name="hobby">游戏
</p>
<p>按钮:
<input type="button"name="btn1"value="点击">
</p>
<p>国家:
<select name="列表名称">
<option value="china">中国</option>
<option value="us">美国</option>
<option value="eth" selected>瑞士</option>
<option value="yd">印度</option>
</select>
</p>
<p>反馈:
<textarea name="textarea" cols="50" rows="10">文本内容</textarea>
</p>
<p>
<input type="file" name="files" >
<input type="button" value="上传" name="upload">
</p>
<p>邮箱:
<input type="email" name="email" >
</p>
<p>URL:
<input type="url" name="url" >
</p>
<p>数字:
<input type="number" name="num" max="100"min="0"step="10">
</p>
<p>音量:
<input type="range"name="voice" min="0"max="100"step="2">
</p>
<p>
<input type="search" name="search">
</p>
<p>
<input type="submit">
<input type="reset" value="清空表单">
</p>
</form>
</body>
</html>
10.1表单的应用
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表单的应用</title>
</head>
<body>
<p>名字:
<input type="text" name="username" value="admin"readonly>
</p>
<p>密码:
<input type="password" name="pwd" hidden>
</p>
<p>
<label for="mark">你点我试试</label>
<input type="text" id="mark">
</p>
<p>
<input type="checkbox" name="sex" value="boy"checked disabled/>男
<input type="checkbox" name="sex" value="girl"/>女
</p>
</body>
</html>