当前位置:首页 » 焦点 » 正文

    html表单代码

    日期:2026-11-23 01:21:28   分类:焦点  作者:自写朝夕人间时光网
    <form action="dede.php" method="POST" name="name1"></form>
    name    <!--名字-->
    value   <!--元素值-->
    checked=“checked” <!--默认值-->
    maxlength=“6”     <!--最多输入几个字符-->

    <input type="radio" name="gender" value="男"  checked=“checked”/>男
    <input type="radio" name="gender" value="女" />女


    1.输入表单元素

    单选按钮

     <input type="radio" name="gender" value="男" />男
    <input type="radio" name="gender" value="女" />女

    定义复选框

    爱好:吃饭 <input type="checkbox" name=“aihao”> 睡觉 <input type="checkbox"> 打豆豆 <input type="checkbox">


    2.下拉表单元素

    <!--书写格式-->
    <select> <option></option> </select>

    <!--默认选择项-->
    selected="select"


    3.文本域元素

    <textarea></textarea>留言板


    4.点击任何元素都能选中单选框

    <td><input type="radio" name="xb" value="男" id="nan"><label for="nan"><img src="../imag/man.png"></label> 男

    <td><input type="radio" name="xb" value="女" id="nv"><label for="nv"><img src="../imag/nv.png"></label> 女


    5.高级表单属性值


    表单示范

    <form action="">
           <ol>
               <li>邮箱<input type="email"></li>
               <li>链接<input type="url"></li>
               <li>日期<input type="date"></li>
               <li>时间<input type="time"></li>
               <li>数字<input type="number"></li>
               <li>数量<input type="tel"></li>
               <li>搜索<input type="search"></li>
               <li>颜色<input type="color"></li>
               <li><input type="submit" value="提交"></li>
           </ol>
       </form>


    表单高级提示

    <!--不能为空-->

    required="required"

    <input type="search" name="" id="" required="required">


    <!--提示文本-->

     placeholder="pink老师"

    /*css*/

    input::placeholder { color: blue;}


    <!--光标自动选取-->

    autofocus="autofocus"


    <!--下拉选取输入过的文字-->

    autocomplete="on"(默认打开)

    /*off*/


    <!--上传多个文件-->

    multiple="multiple"

    <input type="file" name="" id="" multiple="multiple">

     



    留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

    填写好QQ号码,任点空白处自动获取

    昵称

    邮箱

    网址

    Copyright © 2024 Powered by html表单代码 , 凌云白网格社区sitemap 1.0776s , 8256.828125 kb