HTML基础2 表单和框架

时间:2023-03-09 05:28:44
HTML基础2 表单和框架

表单:

<form id="" name="" method="post/get" action"负责处理的服务端"><form>

id不可重复;name可以重复;get提交长度有限制,并且编码后的内容在地址栏可见,post提交无长度限制,且编码后长度不可见。

value  输入的值

disabled  否定input,使按钮失效,满足条件前不可点击

enable 使按钮可用

1.文本输入

文本框<input type="text" value="" />

密码框<input type="password" value="" />

文本域<textarea cols=""(字符多少) rows=""(几行高)></textarea>

隐藏域<input type="hidden" value="" />

2.按钮

提交按钮<input type="submit" value="提交" />  点击后转到form内的提交服务器的地址

重置按钮<input type="reset" value="重置" /> 

普通按钮<input type="button" value="登陆" />

图片按钮<input type="image" src="" />

3.选择输入

单选项按钮

<input type="radio" name="" checked="checked" value="" /> name值用来分组;value值看不见,是提交给程序用的;checked,设置默认选项。

复选框组

<input type="checkbox" />

文件上传

<input type="file" />

<lable for=""></lable>   标签为input元素定义标记,for属性与相关的id属性相同。

下拉列表框

<select size="" multiple="multiple">  size为1时,为菜单;>1时,为列表。  multiple为多选。
<option value="">内容1</option>
<option>内容2</option>
<option selected="selected">内容3</option>   selected,设为默认
</select>

框架

1.frameset

最外层的body换成frameset

<fameset rows="100",* frameborder="no">  上下分,第一行100,剩余为第二行;rows换成cols,为左右分。frameborder="no"去掉分割线

<frame src="页面地址" noresize="noresize">  noresize禁止窗口调整大小

<frame src="" scrolling="no">   scrolling="no"取消显示滚动条

</frameset>

2.iframe    在原来页面嵌入小窗口显示其他页面

<iframe src="其他页面的地址" frameborder="" scrolling="no"></iframe>

frameborder,边线。scrolling,滚动条。如果设置高和宽为0,则不显示,但是在后台会存在这么一个页面。

设计一个邮箱界面

<!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> <body bgcolor="#00FFCC">
<font size="7"><b>邮箱注册</b></font>
<form>
<table width="720" height="75" border="0" cellpadding="10" cellspacing="5">
<tr>
<th align="right">邮箱账号</th>
<td><input type="text" value="" /></td>
</tr><br />
<tr>
<th align="right">密码</th>
<td><input type="password" value="" /></td>
</tr><br />
<tr>
<th align="right">确认密码</th>
<td><input type="password" value="" /></td>
</tr>
<tr>
<th align="right">昵称</th>
<td><input type="text" value="" /></td>
</tr>
<tr>
<th align="right">性别</th>
<td><input type="radio" name="sex" />男<input type="radio" name="sex" />女</td>
</tr>
<tr>
<th align="right">身份证号</th>
<td><input type="text" value="" /></td>
</tr>
<tr>
<th align="right">所在地</th>
<td>
<select size="1">
<option selected="selected">中国</option>
<option>德国</option>
<option>英国</option>
</select>
<select size="1">
<option selected="selected">山东</option>
<option>北京</option>
<option>上海</option>
</select>
<select size="1">
<option selected="selected">淄博</option>
<option>济南</option>
<option>青岛</option>
</select>
</td>
</tr>
<tr>
<th align="right">手机号</th>
<td><input type="text" value="" /></td>
</tr>
</table>
<table width="720" border="0" cellpadding="10" cellspacing="5">
<tr>
<td align="center"><input type="submit" value="提交" /></td>
<td></td>
<td></td>
</tr>
</table> </form>
</body>
</html>