HTML表单相关

时间:2024-04-23 13:35:18

表单:
<input type="text" name="" value="" size="显示字符数" maxlength="最多字符数" readonly="readonly只读" disabled="disabled"不可操作未激活 placeholder="Search W3School">

<input type="password" value="" size="">

<input type="radio" name="sex" value="男" checked="checked" id="man"><label for="man">男</label>&nbsp;
<input type="radio" name="sex" value="女" id="woman"><label form="woamn">女</label>...........name需要相同!!!!!!!

<select name="">
<option selected="" value=""></option>
<option value=""></option>
</select>

<optgroup label="">分组名称
<select name="" size="能够显示的行数" multipule="multiple"多选>
<option value=""></option>
</select>
</optgroup>

<input type="file" size="显示长度" name="">

表单外框
<fieldset></fieldset>
<lenged></lenged>为fieleset定义标题
<input type="reset|submit|button" name="" value="">
<input type="image" src="" name>
<input type="hidden" value="" name="">

<textarea name="" cols="每行几个字" rows="多少行"></textarea>
添加滚动条: <textarea style=“scrollbar:overflow” ></textarea>

水平滚动条
<body style="overflow-x:hidden">
没有垂直滚动条
<body style="overflow-y:hidden">
没有滚动条
<body style="overflow-x:hidden;overflow-y:hidden">或<body style="overflow:hidden">
2.设定多行文本框的滚动条
没有水平滚动条
< textarea style="overflow-x:hidden">< /textarea>
没有垂直滚动条
< textarea style="overflow-y:hidden">< /textarea>
没有滚动条
< textarea style="overflow-x:hidden;overflow-y:hidden">< /textarea>
或< textarea style="overflow:hidden">< /textarea>
3.设定窗口滚动条的颜色
设置窗口滚动条的颜色为红色<body style="scrollbar-base-color:red">
scrollbar-base-color设定的是基本色,一般情况下只需要设置这一个属性就可以达到改变滚动条颜色的目的。
加上一点特别的效果:
<body style="scrollbar-arrow-color:yellow;scrollbar-base-color:lightsalmon">
4.在样式表文件中定义好一个类,调用样式表。
<style>
.coolscrollbar{scrollbar-arrow-color:yellow;scrollbar-base-color:lightsalmon;}
</style>
这样调用:
< textarea class="coolscrollbar">< /textarea>
textarea颜色及边框设置:
< textarea style="border:red solid;border-width:1 1 1 1;color:#CCCCCC;">< /textarea>

overflow-x,overflow-y的可取值为:visible(默认取值),hidden,auto,scroll。

visible:始终不显示滚动条,文本区域的大小会根据内容的增加,自动增长,以显示全部内容。
scroll:不管文本区域里的内容有多少,始终显示滚动条。
hidden:始终不显示滚动条,内容超出层面的对象是不显示。
auto:如果内容在文本区域内可以全部显示,滚动条不显示,当内容无法全部显示时,内容被截断,加上滚动条显示
所有内容。
注】:style的overflow属性必须和width属性结合使用才能生效!

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>注册</title>
</head>
<body>
<table width="700" align="center">
<tr>
<td>
<form action="" name="" method="post">
<fieldset>
<legend>注册</legend>
<table border="1" cellpadding="10" cellspacing="1" width="600" align="center">
<colgroup bgcolor="green" span="1" align="center"></colgroup>
<colgroup bgcolor="yellow" align="center"></colgroup>
<tr>
<td>用户名:</td>
<td><input type="text" name="uesrname" value="" placeholder="用户名为中文" size="10" maxlength="15"></td>
</tr>
<tr>
<td>密码</td>
<td ><input type="password" namw="pwd1"></td>
</tr>
<tr>
<td>确认密码</td>
<td ><input type="password" name="pwd2"></td>
</tr>
<tr>
<td>年龄</td>
<td><input type="text" name="age" value="25"></td>
</tr>
<tr>
<td>性别</td>
<td>
<fieldset>
<legend>请选择性别</legend>
<input type="radio" name="sex" value="男" checked="checked" id="man"><label for="man">男</label>&nbsp;
<input type="radio" name="sex" value="女" id="woman"><label form="woamn">女</label>
</fieldset>
</td>
</tr>
<tr>
<td>城市</td>
<td>
<select name="citys">
<option value="北京" checked="checked">北京</option>
<option value="上海">上海</option>
<option value="常州" >江苏</option>
</select>
</td>
</tr>
<tr>
<td>城市中的地区</td>
<td>
<select name="citys">
<optgroup label="常州">
<option value="武进区">武进区</option>
<option value="钟楼区">钟楼区</option>
<option value="新北区">新北区</option>
<option value="天宁区">天宁区</option>
</optgroup>
<optgroup label="上海">
<option value="武进区">武进区</option>
<option value="钟楼区">钟楼区</option>
<option value="新北区">新北区</option>
<option value="天宁区">天宁区</option>
</optgroup>
</select>
</td>
</tr>
<tr>
<td>交友目的</td>
<td>
<select name="target" size="3" multiple="multiple">
<option value="">普通朋友</option>
<option value="">对象</option>
<option value="">一般朋友</option>
</select>
</td>
</tr>
<tr>
<td>爱好</td>
<td>
<input type="checkbox" name="hobby" value="" id="yisu"><label form="yisu">艺术</label>
<input type="checkbox" name="hobby" value="" id="yinyue"><label form="yinyue">音乐</label>
<input type="checkbox" name="hobby" value="" id="yinyue">唱歌
</td>
</tr>
<tr>
<td>图片上传</td>
<td>
<input type="file" name="">
</td>
</tr>
<tr>
<td>自我介绍</td>
<td>
<textarea name="" rows="6" cols="15"></textarea>
</td>
</tr>
<tr>
<td><input type="hidden" name=""></td>
</tr>
<tr>
<td colspan="2" bgcolor="white">
<input type="submit" value="注册" name="">
<input type="reset" name="" value="重置">
<input type="button" name="" value="普通按钮">
</td>
</tr>
</table>
</fieldset>
</form>
</td>
</tr>
</table>
</body>
</html>

HTML表单相关