Home  >  Article  >  Web Front-end  >  HTML5 attributes: Usage examples of form attributes

HTML5 attributes: Usage examples of form attributes

不言
不言Original
2018-08-09 14:57:122625browse

This article introduces to you about HTML5 attributes: usage examples of form form attributes. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>表单</title>
</head>
<body>
<!-- 表单
action:提交的网址 默认是当前的网址; 自定义
method: 默认:get / post
-->
<form action="" method="post">
<p>
<!-- 1.用户名 -->
<label for="">用户名:</label>
<input id="xx" type="text" placeholder="请输入" name="username">
</p>
<p>
<!-- 2.密码 -->
<label for="">密    码:</label>
<input type="password" name="pwd">
</p>
<p>
<!-- 3.性别 -->
<label for="">性    别:</label>
<input type="radio" name="sex" value="0">男
<input type="radio" name="sex" value="1">女
</p>
<p>
<!-- 4.爱好 -->
<label for="">爱    好:</label>
<input type="checkbox" name="like" value="0">妹子
<input type="checkbox" name="like" value="1">汉子
<input type="checkbox" name="like" value="2">健身
<input type="checkbox" name="like" value="3">游泳
</p>
<p>
<!-- 5.上传文件 -->
<label for="">玉    照:</label>
<input type="file" name="file">
</p>
<p>
<!-- 6.下拉列表 -->
<label for="">籍    贯:</label>
<select name="address" id="">
<option value="0">北京</option>
<option value="1">上海</option>
<option value="2">广东</option>
<option value="3" selected="selected">深圳</option>
</select>
</p>
<p>
<!-- 7.文本域 -->
<label for="">个人描述:</label>
<textarea name="info" id="" cols="30" rows="10"></textarea>
</p>
<p>
<!-- 8.注册 -->
<input type="submit" value="注册">
<!-- 9.重置 -->
<input type="reset">
<!-- 10.隐藏域 -->
<input type="hidden" name="isVIP" value="yes">
<!-- 11.普通按钮 -->
<input type="button" value="普通按钮">
</p>
</form>
</body>
</html>

The running effect is as follows:

HTML5 attributes: Usage examples of form attributes

Recommended related articles:

html5 video (video) and audio (audio) Attribute usage in tags

HTML5 option attribute: How to use the option attribute to implement a cascading drop-down list

The above is the detailed content of HTML5 attributes: Usage examples of form attributes. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn