zoukankan      html  css  js  c++  java
  • 表单

     

    表单的格式:

    <form id="" name="" method="post/get" action="负责处理的服务端"> id不可重复;name可重复;get提交有长度限制,并且编码后的内容在地址栏可见,post提交无长度限制,且编码后内容不可见

    </form>

    1、文本输入

    文本框<input type="txt" name="" id="" value="" />

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

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

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

    注:

    placeholder:使文本框中限时提示性文字,当文本框中未输入任何内容时才显示。

     

    2、按钮

    提交按钮<input type="submit" name="" id="" disabled="disabled" value=""/>点击后转到form内的提交服务器的地址 (提交表单所有内容并刷新页面)

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

    普通按钮<input type="button" name="" id="" disabled="disabled" value=""/>

    图片按钮<input type="image" name="" id="" disabled="disabled" src="图片地址"/>   (图片按钮默认功能与提交按钮一致)

    附:

    disabled,使按钮失效;enable,使可用。

     

    3、选择输入

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

    复选框组<input type="checkbox" name="" checked="checked" value=""/>

    文件上传<input type="file" name="" id="" />

    <lable for=""></lable>

    <label> 标签为 input 元素定义标注(标记)。

    label 元素不会向用户呈现任何特殊效果。不过,它为鼠标用户改进了可用性。如果您在 label 元素内点击文本,就会触发此控件。就是说,当用户选择该标签时,浏览器就会自动将焦点转到和标签相关的表单控件上。

    <label> 标签的 for 属性应当与相关元素的 id 属性相同。

    下拉列表框:

    <select  name="" id="" size="" multiple="multiple">    --size=1时,为菜单;>1时,为列表。multiple为多选。

    <option value="值">内容1</option>

    <option value="值" selected="selected">内容2</option>    --selected,设为默认

    <option value="值">内容3</option>

    </select>

    练习:制作账号注册页面

    <!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 background="1.jpg">
    <table width="500" height="440" border="0" cellpadding="0" cellspacing="0">
    <form>
    <tr height="40">
    <td width="100">邮箱:</td>
    <td><input type="text" required="required" placeholder="例:12345567@qq.com" /></td>
    </tr>
    <tr height="20">
    <td></td>
    <td><font size="-3" color="#666666">需要通过邮箱激活账户,不支持sohu,21cn,sogou的邮箱</font></td>
    </tr>
    <tr height="40">
    <td>登录用户名:</td>
    <td><input type="text" required="required"></td>
    </tr>
    <tr height="20">
    <td></td>
    <td><font size="-3" color="#666666">仅在登陆时使用,字符数不少于4个</font></td>
    </tr>
    <tr height="40">
    <td>显示名称:</td>
    <td><input type="text" /></td>
    </tr>
    <tr height="20">
    <td></td>
    <td><font size="-3" color="#666666">即昵称,字符数不少于2个</font></td>
    </tr>
    <tr height="40">
    <td>密码:</td>
    <td><input type="password" required="required" /></td>
    </tr>
    <tr height="40">
    <td>确认密码:</td>
    <td><input type="password" required="required" /></td>
    </tr>
    <tr height="20">
    <td></td>
    <td><font size="-3" color="#666666">至少8位,必须包含字母、数字、特殊字符</font></td>
    </tr>
    <tr height="40">
    <td>性别:</td>
    <td><input type="radio" name="sex" /><input type="radio" name="sex" /></td>
    </tr>
    <tr height="40">
    <td>喜好:</td>
    <td><input type="checkbox" />听音乐<input type="checkbox" />看电影<input type="checkbox" />玩游戏</td>
    </tr>
    <tr height="40">
    <td>地址:</td>
    <td>
    <select size="1">
    <option>张店区</option>
    <option>淄川区</option>
    <option>临淄区</option>
    <option>博山区</option>
    <option>周村区</option>
    <option>高青县</option>
    <option>桓台县</option>
    <option>沂源县</option>
    </select>
    </td>
    </tr>
    <tr>
    <td></td>
    <td><input type="submit" value="注册" />&nbsp;<input type="reset" /></td>
    </tr>
    </form>
    </table>
    </body>
    </html>

     

  • 相关阅读:
    [转]C#读写app.config中的数据
    [转]DirectoryEntry的应用
    js读取xml文档,并实现简单分页
    [转]写给想要做产品经理的同学
    《算法导论》(第二章)算法入门
    《算法导论》中伪代码的约定
    HDU ACM 1284 钱币兑换问题
    《算法导论》(第一部分)(第一章)
    HDU ACM 4554 叛逆的小明
    HDU ACM 1002 A + B Problem II
  • 原文地址:https://www.cnblogs.com/wt627939556/p/6000992.html
Copyright © 2011-2022 走看看