十一、表单

2017-08-23  本文已影响0人  东东丶酱

1、表单定义

表单是一个包含表单的元素区域

表单元素是允许用户在表单中(比如:文本域、下拉列表、
单选框、复选框等等)输入信息的元素。、

2、表单属性

1、action:规定提交到后台的网址 .php

2、method: 规定如何提交到后台

3、target:规定提交的页面在何处打开 _self _blank

4、name 名字

3、表单控件

<input>标签规定了用户可以在其中输入数据的输入字段。

类型由type属性来决定:

text            文本框
password        密码框
radio           单选按钮
checkbox        复选框
submit  提交form中的数据 
reset       重置按钮
button  按钮 ,多数情况下,通过 JavaScript 启动脚本 
file        上传,供文件上传 
hidden  隐藏
image   图片(有提交功能 过时基本不用)

select/option 下拉选框
size 规定下拉列表中可见选项的数目
selected规定在select里面默认展示项

textarea 文本域
resize 调整尺寸属性

<fieldset> 可将表单内的相关元素分组
<legend> 标签为 fieldset 元素定义标题。

4、关于选择框的选择文字即可选择选项的问题 lable属性

<!-- disabled禁用  checked默认选中 -->
        性别:
         <input type='radio' name='sex' id='man' disabled='disabled' value='' /> <label for='man'>男</label>
         <input type='radio' name='sex' id='woman'/> <label for='woman'>女</label>
         <input type='radio' name='sex' id='nbs' checked='checked'/> <label for='nbs'>女博士</label>

5、关于input focus问题

input{width:400px;height:50px;background:pink;border:none;
            /*外轮廓线*/
            outline:none;
            }
            input:focus{background:#ccc;}//鼠标聚焦效果
上一篇 下一篇

猜你喜欢

热点阅读