HTML table、form表单标签的介绍.pdf
文本预览下载声明
HTML table、form表单标签的介绍
本篇主要介绍 table、form标签以及表单提交方式。
目录
1. table 标签:在HTML 中定义表格布局。
2. form 标签:用于创建 HTML 表单。
3. 表单提交方式:介绍get、post方法。
1. table 标签
1.1 说明
在HTML 中定义表格布局。
1.2格式
table
caption/caption
tr th/th/tr
tbody
trtd/td/tr
trtd/tdtr
tbody
/table
1.3 包含的元素
caption/caption:表头信息。
tr/tr :定义一个表格行;
th/th :定义一个表格头;若是纯文字,默认会以粗体的样式表现。
tbody/tbody :可以理解为表格的内容区域,在Chrome、FF浏览器通过DOM进行表格动态插入行的时候,
要使用这个。如果不进行DOM操作,可不用添加。
td/td :定义一个单元格;
1.4 属性
table 属性:
border :定义表格的边框宽度,默认为0,即无边框。
title :表格的提示信息,当鼠标移到表格上方时,所提示的信息。
th、td 属性:
colspan : 表示横向合并单元格 ( )
rowspan :表示纵向合并单元格 ( )
1.5 示例
table border 0 title 测试
caption 表格标题/caption
tr
th姓名/th
th年龄/th
/tr
tr
td张三/td
td22/td
/tr
tr
tdinput type text //td
tdinput type text //td
/tr
/table
2. form 标签
2.1 说明
form 标签用于创建 HTML 表单。
表单能够包含 input 元素,比如文本字段、复选框、单选框、提交按钮等等。
表单还可以包含 menus、textarea、fieldset和 label 元素 等。
2.2 属性
action {URL}:一个URL地址;指定form表单向何处发送数据。
enctype {string}:规定在发送表单数据之前,如何对表单数据进行编码。
指定的值有:application/xwwwformurlencoded :在发送前编码所有字符 (默认为此方式);
multipart/formdata :不对字符编码。使用包含文件上传控件的表单时,必须使用该值
method {get/post}:指定表单以何种方式发送到指定的页面。
指定的值有:get :from表单里所填的值,附加在action指定的URL后面,做为URL链接而传递。
post :from表单里所填的值,附加在HTML Headers上。
2.3 示例
form enctype multipart/formdata action ashx/login.ashx method post
table
tr
tdlabel for txtname账号:/label/td
tdinput type text id txtname name login_username //td
/tr
tr
tdlabel for txtpswd密码:/label/td
tdinput type password id txtpswd name login_pswd //td
/tr
tr
td colspan 2
input type reset /
input type submit /
/td
/tr
/table
/form
显示全部