蝉网

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
热搜:
查看:4397|回复:9

[转帖] html表单代码

[复制链接]
楼主
发表于2026-11-23 13:46:18|只看该作者回帖奖励|倒序浏览|阅读模式
    <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">


您需要登录后才可以回帖 登录 | 注册

本版积分规则

综合|百科|休闲|知识|娱乐|探索| ( 浙ICP备81366号-1 )

Powered by 蝉网X3.4

© 2001-2017

返回顶部