JavaScript - 纯js写一个对表格的简单增删改查操作

本文展示了一个使用纯JavaScript实现的表格增删改查功能。通过点击按钮,可以实现表格数据的新增、修改和删除。界面简洁,代码逻辑清晰,但存在删除数据后序号未处理及表单验证提示等问题。
摘要由CSDN通过智能技术生成
  • 功能:     新增表格数据,   修改表格数据,  删除表格数据。

不完善区:  删除数据之后序号没有做处理 ,表单验证简单的提示警告, 没有文字提醒。

界面:

在线查看

下面是代码:

  • <!DOCTYPE html>
  • <html lang="en">
  • <head>
  • <meta charset="UTF-8">
  • <meta name="viewport" content="width=device-width, initial-scale=1.0">
  • <meta http-equiv="X-UA-Compatible" content="ie=edge">
  • <title>js</title>
  • <style>
  • * {
  • padding: 0px;
  • margin: 0px;
  • }
  • button {
  • display: inline-block;
  • padding: 8px 20px;
  • background-color: rgb(91, 91, 214);
  • color: #fff;
  • border: 0px;
  • border-radius: 5px;
  • border: 1px solid rgb(149, 149, 236);
  • outline: none;
  • cursor: pointer;
  • }
  • button:active {
  • background-color: rgb(69, 69, 163);
  • }
  • .content {
  • width: 1200px;
  • margin: 0 auto;
  • }
  • .btnGroup {
  • margin-top: 20px;
  • }
  • .content .mytb {
  • text-align: center;
  • }
  • .tableArea {
  • padding-top: 40px;
  • }
  • .mytb {
  • width: 100%;
  • border: 1px solid #cccccc;
  • border-collapse: collapse;
  • }
  • .mytb thead tr {
  • background-color: #666;
  • line-height: 32px;
  • color: #fff;
  • }
  • .mytb tbody {
  • font-size: 14px;
  • font-weight: lighter;
  • color: #333;
  • }
  • .mytb tbody tr:nth-of-type(even) {
  • background-color: #f1f1f1;
  • line-height: 30px;
  • }
  • .mytb tbody tr:nth-of-type(odd) {
  • background-color: #e0e0e0;
  • line-height: 30px;
  • }
  • .mytb tbody tr:nth-of-type(even):hover {
  • background-color: #d1d1d1;
  • cursor: pointer;
  • }
  • .mytb tbody tr:nth-of-type(odd):hover {
  • background-co
  • 4
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值