html——表单(1)
来源:互联网 发布:网络安全教育开题报告 编辑:程序博客网 时间:2024/04/29 03:40
网站怎样与用户进行交互?答案是使用HTML表单(form)。表单是可以把浏览者输入的数据传送到服务器端,这样服务器端程序就可以处理表单传过来的数据。
语法:
<form method="传送方式" action="服务器文件">
讲解:
1.<form> :<form>标签是成对出现的,以<form>开始,以</form>结束。
2.action :浏览者输入的数据被传送到的地方,比如一个PHP页面(save.php)。
3.method : 数据传送的方式(get/post)。
注意:
1、所有表单控件(文本框、文本域、按钮、单选框、复选框等)都必须放在<form></form>标签之间(否则用户输入的信息可提交不到服务器上哦!)。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<form method="post" action="save.php">
<label for="username">用户名:</label>
<input type="text" name="username"/>
<label for="pass">密码:</label>
<input type="password" name="pass"/>
<input type="submit" value="确定" name="submit" />
</form>
</body>
</html>
<form method="post" action="save.php">
<label for="username">用户名:</label>
<input type="text" name="username"/>
<label for="pass">密码:</label>
<input type="password" name="pass"/>
<input type="submit" value="确定" name="submit" />
</form>
</body>
</html>
1、type:
当type="text"时,输入框为文本输入框;
当type="password"时, 输入框为密码输入框。
2、name:为文本框命名,以备后台程序ASP 、PHP使用。
3、value:为文本输入框设置默认值。(一般起到提示作用)
<input type="text" name="username" value="小明"/>
<label for="pass">密码:</label>
<input type="password" name="pass" value="123456"/>
当用户输入有错误需要重新输入的时候,可以使用重置功能:
<input type="reset" value="重置" name="cz"/>
0 0
- html——表单(1)
- HTML——表单
- HTML——表单
- HTML——表单
- html——表单
- HTML—表单
- HTML学习—表单
- HTML表单学习1——表单基础
- HTML 表单标记(1)——form登录
- HTML学习(六)——表单
- [HTML] 琐琐碎碎(二)——HTML表单与输入
- HTML ——表单标记(html控件)
- HTML——表单应用
- HTML——表单标记
- HTML——表格、表单
- HTML常用标签(一)——表单控件&列表
- html——表单2(多行输入)
- html——表单(单选框与复选框)
- 办公软件Cnskype for business自动化系统的作用
- Contains Duplicate II 是否包含重复
- 关于mongoDB 失效数据 ttl ensureIndex
- HTTP原理之HTTP报文(1) 方法
- 阿里云服务器linux系统远程连接
- html——表单(1)
- Python list 基础知识篇
- New String(s) 和 s.toString() 的区别
- C++STL各种实现版本介绍
- XML字符串转换成XML Document对象,并生成在指定路径
- 仓库管理系统系列——2、环境搭建和配置文件
- C/C++二级指针的三种模型(一)
- 理解“渐进增强(Progressive Enhancement)”
- OC瀑布流可拓展headView