现在的位置: 首页 >> 网页设计 >> HTML >> HTML语言教程之五:表单(FORM)标记
添加时间:2005-11-11 来源:网教中国 作者: 未知
HTML语言教程之五:表单(FORM)标记


基本语法
表单的基本语法
<form action="url" method=*>
...
...
<input type=submit> <input type=reset>
</form>
*=GET, POST

表单中提供给用户的输入形式
<input type=* name=**>
*=text, password, checkbox, radio, image, hidden, submit, reset

**=Symbolic Name for CGI script

文字输入和密码输入
*=text, password

<input type=*>
<input type=* value=**>
<form action=/cgi-bin/post-query method=POST>
您的姓名:
<input type=text name=姓名><br>
您的主页的网址:
<input type=text name=网址 value=http://><br>
密码:
<input type=password name=密码><br>
<input type=submit value="发送"><input type=reset value="重设">
</form>


您的姓名:
您的主页的网址:
密码:


<input type=* size=**>
<input type=* maxlength=**>
<form action=/cgi-bin/post-query method=POST>
<input type=text name=a01 size=40><br>
<input type=text name=a02 maxlength=5><br>
<input type=submit><input type=reset>
</form>





复选框(Checkbox) 和 单选框(RadioButton)

<input type=checkbox>
<input type=checkbox checked>
<input type=checkbox value=**>
<form action=/cgi-bin/post-query method=POST>
<input type=checkbox name=水果1>
Banana<p>
<input type=checkbox name=水果2 checked>
Apple<p>
<input type=checkbox name=水果3 value=橘子>
Orange<p>
<input type=submit><input type=reset>
</form>


Banana


Apple

Orange


<input type=radio value=**>
<input type=radio value=** checked>
<form action=/cgi-bin/post-query method=POST>
<input type=radio name=水果>
Banana<p>
<input type=radio name=水果 checked>
Apple<p>
<input type=radio name=水果 value=橘子>
Orange<p>
<input type=submit><input type=reset>
</form>


Banana


Apple

Orange


图象坐标
在下面选则一个系数后,在图象上点一下,就知道什么是图象坐标了! <input type=image src=url>

<form action=/cgi-bin/post-query method=POST>
<input type=image name=face src=f.gif><p>
<input type=radio name=zoom value=2 checked>x2
<input type=radio name=zoom value=4>x4
<input type=radio name=zoom value=6>x6<p>
<input type=reset>
</form>

[page]


x2 x4 x6


隐藏表单的元素 <input type=hidden value=*>
<form action=/cgi-bin/post-query method=POST>
<input type=hidden name=add value=hoge@hoge.jp>
Here is a hidden element. <p>
<input type=submit><input type=reset>
</form>


Here is a hidden element.


</P>


列表框(Selectable Menu)

基本语法
<select name=*>
<option> ...
</select>

<option selected>
<option value=**>
<form action=/cgi-bin/post-query method=POST>
<select name=fruits>
<option>Banana
<option selected>Apple
<option value=My_Favorite>Orange
</select><p>
<input type=submit><input type=reset>
</form>


BananaAppleOrange



<select size=**>
<form action=/cgi-bin/post-query method=POST>
<select name=fruits size=3>
<option>Banana
<option selected>Apple
<option value=My_Favorite>Orange
<option>Peach
</select><p>
<input type=submit><input type=reset>
</form>


BananaAppleOrangePeach



<select size=** multiple> 注意,是用 Ctrl 键配合鼠标实现多选。
(和 MS-WINDOWS 的 File Manager 一样)
<form action=/cgi-bin/post-query method=POST>
<select name=fruits size=3 multiple>
<option selected>Banana
<option selected>Apple
<option value=My_Favorite>Orange
<option selected>Peach
</select><p>
<input type=submit><input type=reset>
</form>

BananaAppleOrangePeach



文本区域 <textarea name=* rows=** cols=**> ... <textarea>
<form action=/cgi-bin/post-query method=POST>
<textarea name=comment rows=5 cols=60>
</textarea>
<P>
<input type=submit><input type=reset>
</form>




对于很长的行是否进行换行的设置(Word Wrapping) <textarea wrap=off> ... </textarea>
不换行,是缺省设置。

<textarea wrap=soft> ... </textarea> “软换行”,好象 MS-WORD 里的“软回车”。
<form action=/cgi-bin/post-query method=POST>
<textarea wrap=soft name=comment rows=5 cols=25> </textarea><P>
<input type=submit><input type=reset>
</form>



[1] [2]  下一页


上一篇:HTML语言教程之六:表格(TABLE)标记 下一篇:HTML语言教程之四:图像(IMAGE)标记
大部分文章摘自网上,如有侵犯您的权益请与我们联系,我们会第一时间进行处理,谢谢! [ 打印文章 ] [ 关闭窗口 ]
推荐文章
·模仿QQ和MSN消息提示的效果
·动态HTML教程(五)
·表格(Table)
·用好活动字幕标记—marquee
·HTML语言的语法基础及规则
·中文网页制作中段落缩进的方法
·HTML彻底剖析(2)标记一览
·快速精通掌握框架的使用
·感受Web标准,第一次DIV+CSS
·网页制作,使用HTML常范的五个错
相关文章
 
最新文章
·让自己的网站也拥有权威IT报价系
·在网页中实现细线边框的两种方法
·ASP脚本循环语句
·小偷程序原理和简单示例
·精彩:用Asp实现QQ在线查询
·“mailto”的六则应用技巧
·meta标签之详解
·为你的网页链接加上快捷键
·如何在网页中制作虚线表格
·连动下拉菜单
Google