1、<select>元素

<select>元素定义下拉列表

<option>元素定义待选择的选项,通常默认第一个显示为备选选项,也可以用selected属性定义显示的备选选项

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form action="http://www.baidu.com">
<select name="colors">
<option value="red">red</option>
<option value="red" selected>blue</option>
<option value="red">green</option>
<option value="red">black</option>
</select>
<br/>
<br/>
<input type="submit" value="submit">
</form>
</body>
</html>

结果:


HTML表单元素

2、<textarea>元素定义多行输入字段


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form action="http:www.baidu.com">
<textarea name="message" rows="10" cols="30">
the cat is playing in de garden
the cat is playing in de garden
the cat is playing in de garden
the cat is playing in de garden
</textarea>
</form>
</body>
</html

结果:

HTML表单元素

3、<button>元素定义可点击的按钮

比如 弹出警告窗口

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<button type="button" onclick="alert('hello world')">click me</button>
</body>
</html>

HTML表单元素

4、HTML5表单

<datalist>

<******>

<output>


相关文章: