小九九学前端随记08

编程入门 行业动态 更新时间:2024-10-25 11:21:55

小<a href=https://www.elefans.com/category/jswz/34/1766529.html style=九九学前端随记08"/>

小九九学前端随记08

文本、密码输入框

<input type="text/password" name="myName" > type="text"为文本,type="password"为密码输入框。

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>文本、密码输入框</title>
</head>
<body>
<form  method="post" action="save.php">账户: <input type="text" name="name" > <br>密码: <input type="password" name="pass" >
</form> 
</body>
</html>
文本域

<textarea cols="50" rows="10">在这里输入内容...</textarea>

单选框、复选框

<input   type="radio/checkbox"   value="值"    name="名称"   checked="checked"/>

1、type:     当 type="radio" 时,控件为单选框,当 type="checkbox" 时,控件为复选框。

2、value:提交数据到服务器的值(后台程序PHP使用)。

3、name:为控件命名,以备后台程序 ASP、PHP 使用。

4、checked:当设置 checked="checked" 时,该选项被默认选中。

5、同一组的单选按钮,name 取值一定要一致,这样同一组的单选按钮才可以起到单选的作用。

下拉列表框

设置<select multiple="multiple">,就可以实现多选功能,按下Ctrl键同时进行单击。

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>下拉列表框</title>
</head>
<body>
<form action="save.php" method="post" ><label>爱好:</label><select><option value="看书">看书</option><option value="旅游" selected="selected">旅游</option><option value="运动">运动</option><option value="购物">购物</option></select>
</form>
</body>
</html>
按钮的提交 与重置

<input   type="submit"   value="提交">,<input type="reset" value="重置">

label

<label for="控件id">名称</label>,在 label 标签内点击文本,就会触发此控件。就是说,当用户单击选中该label标签时,浏览器就会自动将焦点转到和标签相关的表单控件上(就自动选中和该label标签相关连的表单控件上)。

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>form中的lable标签</title>
</head><body>
<form><label for="male">男</label><input type="radio" name="gender" id="male" /><br /><label for="female">女</label><input type="radio" name="gender" id="female" /><br /><label for="email">输入你的邮箱地址</label><input type="email" id="email" placeholder="Enter email"></form></body>
</html>






更多推荐

小九九学前端随记08

本文发布于:2024-03-08 15:09:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1721227.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:九九

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!