HTML 表格(form/table)

实现一个表格:
这里写图片描述

3.css:
table,tr,td{
    margin:0 auto;
    border:1px solid;
    border-style:groove;(凹陷效果)
}


input{
    border-style:groove;

    background:lightblue;
    color:red;
}

a:link {color:blue;} /* 未访问的链接 */
a:visited {color:gray;} /* 已访问的链接 */
a:hover {color:red;} /* 鼠标划过链接 */
a:active {color:black;} /* 已选中的链接 */
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
    <link href="3.css" type="text/css" rel="stylesheet"/>
</head>
<body>
    <form action="reg_check.jsp" method="post">
        <table>
            <tr>
                <td colspan="2" align="center">
                    用户注册信息
                </td>
            </tr>
            <tr>
                <td class="left">
                    用户名
                </td>
                <td style="width:250px">
                    <input type="text" name="user" style="width:150px"/>
                </td>
            </tr>
            <tr>
                <td class="left">
                    密&nbsp&nbsp&nbsp码
                </td>
                <td style="width:250px">
                    <input type="password" name="pw" style="width:150px"/>
                    </td>
            </tr>
            <tr>
                <td class="left">
                    校验密码
                </td>
                <td style="width:250px">
                    <input type="password" style="width:150px" maxlengh="16"/>
                </td>
            </tr>
            <tr>
                <td class="left">
                    籍&nbsp&nbsp&nbsp贯
                </td>
                <td>
                    <select name="place">
                        <option>
                            浙江
                        </option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    兴趣爱好
                </td>
                <td class="left">
                    <input type="checkbox"/>篮球
                    <input type="checkbox"/>足球
                    <input type="checkbox"/>书法
                    <input type="checkbox"/>音乐
                    <br>
                    <input type="checkbox"/>绘画
                    <input type="checkbox"/>散打
                    <input type="checkbox"/>瑜伽
                    <input type="checkbox"/>其他
                </td>
            </tr>
            <tr>
                <td>
                    政治面貌
                </td>
                <td>
                    <input type="radio"/>党员
                    <input type="radio"/>团员
                    <input type="radio"/>群众
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <button type="button">
                        提交
                    </button>
                    <button type="button">
                        重置
                    </button>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="2">
                    <a href="">注册帮助信息请点击这里</a>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>

不建议使用的标签:
<center> 不赞成使用。定义居中文本。
<font> 不赞成使用。定义文字的字体、尺寸和颜色。

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
若你想在layui中使用表格,需要先引入layui框架,并且加载layui.form模块。在HTML中,你需要构建一个table元素,并为其添加lay-filter属性,用于layui识别。接着,你需要在JavaScript代码中使用layui.table.render()方法来渲染表格,同时需要将lay-filter属性与表格ID传入。 示例代码如下: HTML: ``` <table class="layui-hide" id="demo" lay-filter="test"></table> ``` JavaScript: ``` layui.use(['table', 'form'], function(){ var table = layui.table; var form = layui.form; //渲染表格 table.render({ elem: '#demo', url: '/api/table', toolbar: '#toolbarDemo', page: true, cols: [[ {type: 'checkbox'}, {field: 'id', title: 'ID', width: 80}, {field: 'username', title: '用户名', width: 120}, {field: 'email', title: '邮箱', minWidth: 150}, {field: 'sex', title: '性别', width: 80, sort: true}, {field: 'city', title: '城市', width: 100}, {field: 'sign', title: '签名', minWidth: 120}, {field: 'experience', title: '积分', width: 80, sort: true}, {field: 'score', title: '评分', width: 80, sort: true}, {field: 'classify', title: '职业', width: 100}, {field: 'wealth', title: '财富', sort: true}, {fixed: 'right', title:'操作', toolbar: '#barDemo', width:150} ]] }); //监听工具条 table.on('tool(test)', function(obj){ var data = obj.data; if(obj.event === 'detail'){ layer.msg('ID:'+ data.id + ' 的查看操作'); } else if(obj.event === 'del'){ layer.confirm('真的删除行么', function(index){ obj.del(); layer.close(index); }); } else if(obj.event === 'edit'){ layer.alert('编辑行:<br>'+ JSON.stringify(data)) } }); //监听复选框 table.on('checkbox(test)', function(obj){ console.log(obj) }); //监听单元格编辑 table.on('edit(test)', function(obj){ console.log(obj) }); //监听排序 table.on('sort(test)', function(obj){ console.log(obj) }); }); ``` 上述代码中,我们使用了layui.form模块来监听表格的复选框、单元格编辑和排序功能。同时,在HTML中也定义了一个toolbar,用于添加表格中的操作按钮。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值