zoukankan      html  css  js  c++  java
  • html表单 2017-03-10PM

    在写表单之前补充一点:网页名以及属性的值命名都不能用中文,尽量用英文或拼音。

    html表单特写

    1、表单格式

    <form method="get/post" action="data.html" target="_blank/_self">

    <input/>

    </form>

    注:表单属性:

    Method是指网页传输方式,get是直接传递,提交有长度限制,并且编码后的内容在地址栏可见;post是从后台传递,提交无长度限制,且编码后内容不可见。

    Action是负责接受的文件。

    Target 是指打开方式

    2、文本输入

     (1)文本框

     <input type="text" name="user name" value/placehoder="提示文字"/>

    注:

    value 与placeholder都是将信息显示在文本框中,在输入文本框时,value(显示为黑色)需要重新删除;placeholder会显示(为灰色)但不占位,输上信息后消失。

    (2)密码

    <input type="password" name="psd" readonly="readonly" value="1234"/>

    :readonly表示只读,不希望别人修改value的值。效果等同于disabled.

     (3) 文本域

    <textarea  rows="行数" maxlength="字的长度"></textarea>

    (4)隐藏域

    <input type="hidden" name=" " value=" "/>

    注:虽不显示,可用于后台统计数据;也可用于编写不想让用户看到的信息。

    3、按钮

    (1)提交按钮

    <input type="submit" name=" " value="按钮名称" disabled="disabled" />

    (2)重置按钮

    <input type="reset" value="重置" disabled="disabled" />

    (3) 图片按钮  = 作用等同于提交按钮

    <input type="image" src="./1.jpg" width="100" height="100" disabled="disabled"/>

    (4)普通按钮

    <input type="button" name=" " value="注册" />

    4、选择输入

    (1)单选按钮

    格式:

    <input type="radio" name="sex" value="1" id="s1" checked="checked"/>

    <label for="s1">男</label>

    <input type="radio" name="sex" value="0" id="s2" />

    <label for="s2">女</label>

    注:

    a.同一个name的分为一组(即当选中一个时,其他的不能再选) 

    b、value值时看不见的,直接提交给程序;

    c、cheked是默认选项,不会影响你的选择。 

    d、lable标签作用:当你鼠标点击汉字“男”“女”时,你也会选中。注意for的值要等于id的值。

    (2)复选框

         <input type="checkbox" name="c1" value="v1" id="s2" />

                <label for="s2" >足球</label>

        <input type="checkbox" name="c2" value="v2" id="s3" />

                <label for="s3" checked="checked">篮球</label>

        <input type="checkbox" name="c3" value="v3" id="s4" />

                <label for="s4">乒乓球</label>

    :checked设为默认。

    (3)下拉列表

    <select name="set" size=" " multiple="multiple">

                  <option value="1112">张店</option>

                  <option selected="selected">沂源</option>

                  <option>桓台</option>

                  <option>石桥</option>

    </select>

        注:selected设为默认。

    上传的值有优先顺序,有value值的先传value值(选择提交后在地址栏优先显示)。

    问题:name,value, id有什么区别?

     name:设定的值提交给后台,不会显示在网页中,用于提交数据。

     value:设定的值在按钮标签中显示的是按钮名称;在文本框中显示的是值的内容;

    Reflections:

    Remember accurately and practice agian and again.

    Thanks for the day is a sunny day; thanks for the people I met; and thanks for everything.

    Hope everything goes ok.

              

  • 相关阅读:
    ASM ClassReader failed to parse class file
    idea运行java项目js中文乱码如何解决
    Error:(182, 32) java: 常量字符串过长
    ssh启动报错:org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect
    [Intro to Deep Learning with PyTorch -- L2 -- N14] Sigmoid function
    [CSS3] CSS Selector
    [HTML5] document.activeElement
    [Intro to Deep Learning with PyTorch -- L2 -- N9] Perceptron Trick
    [Javascript] Broadcaster, operator, listener pattern: Write a debounce operator -- 1
    [CSS] place-content = align-items + justify-content
  • 原文地址:https://www.cnblogs.com/chenguanai/p/6532567.html
Copyright © 2011-2022 走看看