菜鸟自学PHP

HTML5表单学习

2016-04-20  本文已影响24人  xlogcc

学习地址:http://www.w3school.com.cn/tags/tag_form.asp

文本域(text fields)

<html>

<body>

<form method="post" action="">

姓:<input type="text" name="xing">

名:<input type="text" name="ming">

</form>

</body>

</html>

代码中的type="text"就是文本域的书写形式.

密码域:

<input type="password" name="password">

复选框:

<input  type="checkbox" name="car">

<input type="checkbox" name="bike">

复选框的意思就是一次可以选择多个选项.

单选框:

男性:<input type="radio" checked="checked"  name="sex" value="male">

女性:<input type="radio" name="sex" value="female">

checked="checked"表示默认选中的项.

下拉列表:

<form>

<select name="cars">

<option value="audi">audi</option>

<option value="ford">ford</option>

<option value="volvo">volvo</option>

</select>

</form>

带选中的下拉列表:

<select name="cars">

<option value="audi">audi</option>

<option value="ford" selected="selected">ford</option>

<option value="volvo">volvo</option>

</select>

文本域(textarea)

<textarea name="content" cols="20" rows="10"> 这里是填写内容的地方.</textarea>

创建按钮:

<input tpye="button" value="这是自定义按钮名字">

围绕数据的fieldset:

<form>

<fieldset>

<legend>围绕数据说明</legend>

<input type="text" name="a">

<input type="text" name="b">

</fieldset>

</form>

确认按钮:

<input type="submit" value="确认">

重置按钮:

<input type="reset" value="重置">


电子邮件发送表单:

这个不写代码了感觉用途不大,贴个图吧.

表单的学习感觉太简单了,其实通常用到的蛮多.这个要重点关注学习下.

上一篇 下一篇

猜你喜欢

热点阅读