当前位置: 首页 > wzjs >正文

专业3合1网站建设公司seo标题优化

专业3合1网站建设公司,seo标题优化,教人做辐射4mod的网站,外贸网站建设优化题五:动态表格 要求: 1.表格由专业班级学号1-10号同学的信息组成,包括:学号、姓 名、性别、二级学院、班级、专业、辅导员; 2.表格的奇数行字体为黑色,底色为白色;偶数行字体为白色&#xff…

题五:动态表格

要求:

1.表格由专业班级学号1-10号同学的信息组成,包括:学号、姓 名、性别、二级学院、班级、专业、辅导员;

2.表格的奇数行字体为黑色,底色为白色;偶数行字体为白色,底 色为黑色;

3.表格的每一行后有一个删除按钮,点击后会跳出提示弹窗,确认后删除该行的内容,并且删除后上述的颜色规律保持不变:

4.表格的右上方有一个添加按钮,点击后跳出一个表单弹窗,可以填加新的学生的信息。

html

<body><div class="table-container"><button id="add-btn" class="add-btn">添加学生</button><table class="student-table"><thead><tr><th>学号</th><th>姓名</th><th>性别</th><th>二级学院</th><th>班级</th><th>专业</th><th>辅导员</th><th>操作</th></tr></thead><tbody><tr><td>1</td><td>张三</td><td>男</td><td>计算机学院</td><td>1班</td><td>软件工程</td><td>赵老师</td><td><button class="delete-btn">删除</button></td></tr><tr><td>2</td><td>李四</td><td>女</td><td>信息学院</td><td>2班</td><td>网络工程</td><td>王老师</td><td><button class="delete-btn">删除</button></td></tr></tbody></table></div><div class="form-popup" id="add-form"><h3>添加学生信息</h3><input type="text" id="student-id" placeholder="学号"><input type="text" id="student-name" placeholder="姓名"><input type="text" id="student-gender" placeholder="性别"><input type="text" id="student-college" placeholder="二级学院"><input type="text" id="student-class" placeholder="班级"><input type="text" id="student-major" placeholder="专业"><input type="text" id="student-counselor" placeholder="辅导员"><button id="submit-add">提交</button><button id="cancel-add">取消</button></div>

css

 body {margin: 0;padding: 0;background-color: #fff;}.table-container {max-width: 1200px;margin: 50px auto;padding: 20px;background-color: #fff;position: relative;}.add-btn {position: absolute;top: 0px;right: 0px;padding: 10px 20px;background-color: #28a745;color: white;border: none;cursor: pointer;border-radius: 4px;}.add-btn:hover {background-color: #218838;}table {width: 100%;border-collapse: collapse;}th,td {padding: 10px;text-align: left;border: 1px solid #ddd;}th {background-color: #007bff;color: white;}tr:nth-child(odd) {background-color: #ffffff;color: black;}tr:nth-child(even) {background-color: black;color: #ffffff;}.delete-btn {padding: 5px 10px;color: #fff;border: none;cursor: pointer;border-radius: 4px;background: #007bff;}.delete-btn:hover {background-color: red;}.form-popup {display: none;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);background-color: white;padding: 20px;box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);z-index: 10;}.form-popup input {display: block;width: 100%;margin-bottom: 10px;padding: 5px;}.form-popup button {padding: 5px 10px;margin-right: 10px;}

js

 document.addEventListener('DOMContentLoaded', function () {// 获取表格元素const studentTable = document.querySelector('.student-table');const tbody = studentTable.querySelector('tbody');const addBtn = document.getElementById('add-btn');const addForm = document.getElementById('add-form');const submitAdd = document.getElementById('submit-add');const cancelAdd = document.getElementById('cancel-add');// 为所有已有的删除按钮添加点击事件处理document.querySelectorAll('.delete-btn').forEach(btn => {btn.addEventListener('click', function () {if (confirm('确定要删除该学生信息吗?')) {const row = btn.closest('tr');row.remove();updateRowColors();}});});// 显示添加表单addBtn.addEventListener('click', function () {addForm.style.display = 'block';});// 取消添加cancelAdd.addEventListener('click', function () {addForm.style.display = 'none';});// 提交添加信息submitAdd.addEventListener('click', function () {const id = document.getElementById('student-id').value;const name = document.getElementById('student-name').value;const gender = document.getElementById('student-gender').value;const college = document.getElementById('student-college').value;const classInfo = document.getElementById('student-class').value;const major = document.getElementById('student-major').value;const counselor = document.getElementById('student-counselor').value;if (id && name && gender && college && classInfo && major && counselor) {const newRow = document.createElement('tr');const cells = [id, name, gender, college, classInfo, major, counselor];cells.forEach(cellText => {const cell = document.createElement('td');cell.textContent = cellText;newRow.appendChild(cell);});const deleteCell = document.createElement('td');const deleteBtn = document.createElement('button');deleteBtn.classList.add('delete-btn');deleteBtn.textContent = '删除';deleteBtn.addEventListener('click', function () {if (confirm('确定要删除该学生信息吗?')) {const row = deleteBtn.closest('tr');row.remove();updateRowColors();}});deleteCell.appendChild(deleteBtn);newRow.appendChild(deleteCell);tbody.appendChild(newRow);addForm.style.display = 'none';updateRowColors();// 清空表单document.querySelectorAll('student-id').value = '';document.querySelectorAll('student-name').value = '';document.querySelectorAll('student-gender').value = '';document.querySelectorAll('student-college').value = '';document.querySelectorAll('student-class').value = '';document.querySelectorAll('student-major').value = '';document.querySelectorAll('student-counselor').value = '';} else {alert('请填写所有信息!');}});// 更新表格行的颜色,确保奇偶行颜色交替function updateRowColors() {const rows = studentTable.querySelectorAll('tbody tr');rows.forEach((row, index) => {row.style.backgroundColor = index % 2 === 0 ? '#ffffff' : '#000000';row.style.color = index % 2 === 0 ? '#000000' : '#ffffff';});}// 初始化表格行颜色updateRowColors();});

js第五题

http://www.dtcms.com/wzjs/387732.html

相关文章:

  • 给金融的做网站 犯法吗深圳百度推广关键词推广
  • 分类信息网站制作好123上网主页
  • 慈善公益网站建设韶关新闻最新今日头条
  • wordpress判断手机海淀区seo全面优化
  • 建设网站怎么赚钱自动外链工具
  • 企业为啥要做网站深圳seo招聘
  • 做网站还是软件百度竞价
  • 温州网站建设费用刷关键词的平台
  • 山东省建设职业教育集团网站优化推广网站seo
  • 帮人做网站一个多少钱整合营销策略
  • 个人响应式网站建设怎么开发一个网站
  • 自己可以做网站服务器百度上怎么做推广
  • wordpress 交互深圳网站快速排名优化
  • 武汉网站整合营销联系方式中国国家培训网正规吗
  • 做动态头像的网站天津seo选天津旗舰科技a
  • 网站怎么做301seo是什么意思 seo是什么职位
  • 河南网站优化泉州百度关键词优化
  • 做洁净的网站手机网站智能建站
  • 容桂销售型网站建设百度识图查另一半情头
  • 阿里云智能logo设计网站网站怎么快速被百度收录
  • 初中生电脑作业做网站行业关键词分类
  • 做网站有哪些平台免费加客源
  • 南京网站群建设公司seo具体seo怎么优化
  • 电子商务网站硬件建设的核心百度seo指南
  • 企业网站建设哪里做网站好seo外包上海
  • 一般请人做网站和app多少钱常德论坛网站
  • 义乌开锁做网站哪个好抖音seo是什么意思
  • 怎么建立织梦网站sem对seo的影响有哪些
  • 网站优化建设郑州制作一个网站的流程有哪些
  • 网站的跟目录trinseo公司