HTML表格的相关属性
<table>
bgcolor(背景颜色)、border(边框),
bordercolor(边框颜色)、cellspacing(单元格之间间隔),cellpadding(单元格与内容之间间隔)、width(宽)、height(高)
<td>
align、valign、bgcolor、width、height、colspan、rowspan
为什么要使用表单?
用于向服务器传数据
B与S交互
HTML表单
HTML表单是用于搜集用户输入的
HTML表单都扩在一对form标签中
<form>的常用属性
action表示提交的目标服务器
method提交的方法get、post
get(默认,以url提交,就是以地址栏的方式提交)
post(通过报文提交)
HTML表单——表单元素的基本格式
文本框标签
<input type = “text“ />
密码框标签
<input type = “password” />
请输入密码:<input type="password" name="pwd" value="" /><br />
文本域标签
<textarea>内容</textarea>
属性rows(行)和cols(列)
<textarea>哈哈</textarea>
提交按钮标签
<input type=“submit” />(如果添加name就提交了)
<input type="submit" name="btn" value="提交" /><br />
重设按钮标签
<input type=“reset” />(重置,可以添加value)
按钮标签
<input type=“button” />
<input type="button" value="按钮" onclick="alert('不要乱按')" />
图像标签
<input type=“image” />
复选框标签(有name才能提交)
<input type=“checkbox” />
<input type=“checkbox” name=“ch1” value=“chone” checked=”checked“ />文字
单选按钮签(没name点不了)
<input type=“radio” />input type=“radio” name=“ra1” value=“raOne” checked=“checked“ />男(默认加checked=“checked”)
文件选择标签
<input type=“file” />
<input type=“file” name=“f1” value=“fOne” />各个浏览器不同
HTML标签
列表标签
<select>(name在这加才能提交)
<option>< /option>(Items)
</select>
<option value="0">@itcast.com</option>
属性size(1或非1)(listbox)
属性multiple(多选)
属性value和selected(默认谁是第一个)
练习8
HTML分区标签
<div></div>
<span></span>