小言_互联网的博客

学生信息管理系统(纯前端页面)———无后端数据库

273人阅读  评论(0)

无后端数据库版本的----学生信息管理系统

文末下载地址

因为不少人说GitHub的链接资源下载缓慢或者下不了,所以我放了CSDN的下载链接。

应该是不要积分的,我设置的0积分下载。

学生信息管理系统下载链接(CSDN)

 

这学期的前端作业很奇怪,不用数据库实现学生信息管理系统,随便写了下。

具体功能如下:

  1. 实现了查看信息(单击查看按钮,查看具体信息,且为不可修改格式)
  2. 实现了修改信息功能(单击修改按钮,可以对学生的信息进行修改)
  3. 实现了新增功能(可以新增加一个学生的信息,添加到最后边)
  4. 实现了删除功能(在复选框中选择几个就删除几个)
  5. 实现了全选功能(单击第一个复选框,就会选择所有的学生列表)
  6. 实现了翻页功能(统计共有多少条数据,当前页,下一页,上一页功能)
  7. 具体还有一些鼠标触碰了显示效果

如图所示:

具体代码如下:


  
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml/DTD/xhtml-transitional.dtd">
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>学生信息管理系统 </title>
  6. <link rel="stylesheet" type="text/css" href="css/studentInformationManage.css">
  7. </head>
  8. <body>
  9. <div class="wrapperBox">
  10. <div class="header">
  11. <div class="headerTitle">
  12. <div class="headerLine">学生信息管理系统 </div>
  13. </div>
  14. <div class="headerButton">
  15. <button class="addButton">新增 </button>
  16. <button id="deleteButton">删除 </button>
  17. </div>
  18. </div>
  19. <div class="container">
  20. <table id="containerTable">
  21. <thead class="tableHeaher">
  22. <tr>
  23. <th> <input type="checkbox"> </th>
  24. <th>序号 </th>
  25. <th>学号 </th>
  26. <th>姓名 </th>
  27. <th>学院 </th>
  28. <th>专业 </th>
  29. <th>年级 </th>
  30. <th>班级 </th>
  31. <th>年龄 </th>
  32. <th>操作 </th>
  33. </tr>
  34. </thead>
  35. <tbody id="tdata">
  36. <tr class="trHover">
  37. <td> <input type="checkbox"> </td>
  38. <td class="stuSequence">1 </td>
  39. <td class="stuId">11503080210 </td>
  40. <td class="stuName">张三 </td>
  41. <td class="stuAcademy">计算机科学与工程学院 </td>
  42. <td class="stuMajor">软件工程 </td>
  43. <td class="stuYear">2015 </td>
  44. <td class="stuClass">2 </td>
  45. <td class="stuAge">21 </td>
  46. <td>
  47. <a class="viewInf ">查看 </a>
  48. <a class="updateInf ">修改 </a>
  49. </td>
  50. </tr>
  51. <tr class="trHover">
  52. <td> <input type="checkbox"> </td>
  53. <td class="stuSequence">2 </td>
  54. <td class="stuId">11503080210 </td>
  55. <td class="stuName">李四 </td>
  56. <td class="stuAcademy">会计学院 </td>
  57. <td class="stuMajor">会计学 </td>
  58. <td class="stuYear">2015 </td>
  59. <td class="stuClass">2 </td>
  60. <td class="stuAge">19 </td>
  61. <td>
  62. <a class="viewInf ">查看 </a>
  63. <a class="updateInf ">修改 </a>
  64. </td>
  65. </tr>
  66. <tr class="trHover">
  67. <td> <input type="checkbox"> </td>
  68. <td class="stuSequence">3 </td>
  69. <td class="stuId">11503080210 </td>
  70. <td class="stuName">王五 </td>
  71. <td class="stuAcademy">理学院 </td>
  72. <td class="stuMajor">软件工程 </td>
  73. <td class="stuYear">2015 </td>
  74. <td class="stuClass">2 </td>
  75. <td class="stuAge">18 </td>
  76. <td>
  77. <a class="viewInf ">查看 </a>
  78. <a class="updateInf ">修改 </a>
  79. </td>
  80. </tr>
  81. <tr class="trHover">
  82. <td> <input type="checkbox"> </td>
  83. <td class="stuSequence">4 </td>
  84. <td class="stuId">11503080210 </td>
  85. <td class="stuName">赵六 </td>
  86. <td class="stuAcademy">理学院 </td>
  87. <td class="stuMajor">软件工程 </td>
  88. <td class="stuYear">2000 </td>
  89. <td class="stuClass">6 </td>
  90. <td class="stuAge">21 </td>
  91. <td>
  92. <a class="viewInf ">查看 </a>
  93. <a class="updateInf ">修改 </a>
  94. </td>
  95. </tr>
  96. <tr class="trHover">
  97. <td> <input type="checkbox"> </td>
  98. <td class="stuSequence">5 </td>
  99. <td class="stuId">11503080210 </td>
  100. <td class="stuName">张三 </td>
  101. <td class="stuAcademy">机械学院 </td>
  102. <td class="stuMajor">修车 </td>
  103. <td class="stuYear">2015 </td>
  104. <td class="stuClass">1 </td>
  105. <td class="stuAge">21 </td>
  106. <td>
  107. <a class="viewInf ">查看 </a>
  108. <a class="updateInf ">修改 </a>
  109. </td>
  110. </tr>
  111. <tr class="trHover">
  112. <td> <input type="checkbox"> </td>
  113. <td class="stuSequence">6 </td>
  114. <td class="stuId">11503080210 </td>
  115. <td class="stuName">张三 </td>
  116. <td class="stuAcademy">应用技术学院 </td>
  117. <td class="stuMajor">软件工程的的 </td>
  118. <td class="stuYear">2015 </td>
  119. <td class="stuClass">2 </td>
  120. <td class="stuAge">21 </td>
  121. <td>
  122. <a class="viewInf ">查看 </a>
  123. <a class="updateInf ">修改 </a>
  124. </td>
  125. </tr>
  126. <tr class="trHover">
  127. <td> <input type="checkbox"> </td>
  128. <td class="stuSequence">7 </td>
  129. <td class="stuId">11503080210 </td>
  130. <td class="stuName">王五 </td>
  131. <td class="stuAcademy">外国语学院 </td>
  132. <td class="stuMajor">英语 </td>
  133. <td class="stuYear">2017 </td>
  134. <td class="stuClass">2 </td>
  135. <td class="stuAge">21 </td>
  136. <td>
  137. <a class="viewInf ">查看 </a>
  138. <a class="updateInf ">修改 </a>
  139. </td>
  140. </tr>
  141. <tr class="trHover">
  142. <td> <input type="checkbox"> </td>
  143. <td class="stuSequence">8 </td>
  144. <td class="stuId">11503080210 </td>
  145. <td class="stuName">张三 </td>
  146. <td class="stuAcademy">计算机科学与工程学院 </td>
  147. <td class="stuMajor">软件工程 </td>
  148. <td class="stuYear">2017 </td>
  149. <td class="stuClass">2 </td>
  150. <td class="stuAge">21 </td>
  151. <td>
  152. <a class="viewInf ">查看 </a>
  153. <a class="updateInf ">修改 </a>
  154. </td>
  155. </tr>
  156. <tr class="trHover">
  157. <td> <input type="checkbox"> </td>
  158. <td class="stuSequence">9 </td>
  159. <td class="stuId">11503080210 </td>
  160. <td class="stuName">张三 </td>
  161. <td class="stuAcademy">应用技术学院 </td>
  162. <td class="stuMajor">软件工程 </td>
  163. <td class="stuYear">2018 </td>
  164. <td class="stuClass">2 </td>
  165. <td class="stuAge">21 </td>
  166. <td>
  167. <a class="viewInf ">查看 </a>
  168. <a class="updateInf ">修改 </a>
  169. </td>
  170. </tr>
  171. <tr class="trHover">
  172. <td> <input type="checkbox"> </td>
  173. <td class="stuSequence">10 </td>
  174. <td class="stuId">11503080210 </td>
  175. <td class="stuName">张三 </td>
  176. <td class="stuAcademy">计算机科学与工程学院 </td>
  177. <td class="stuMajor">软件工程 </td>
  178. <td class="stuYear">2015 </td>
  179. <td class="stuClass">2 </td>
  180. <td class="stuAge">21 </td>
  181. <td>
  182. <a class="viewInf ">查看 </a>
  183. <a class="updateInf ">修改 </a>
  184. </td>
  185. </tr>
  186. <tr class="trHover">
  187. <td> <input type="checkbox"> </td>
  188. <td class="stuSequence">1 </td>
  189. <td class="stuId">11503080210 </td>
  190. <td class="stuName">王大大 </td>
  191. <td class="stuAcademy">应用技术学院 </td>
  192. <td class="stuMajor">修路 </td>
  193. <td class="stuYear">2015 </td>
  194. <td class="stuClass">2 </td>
  195. <td class="stuAge">21 </td>
  196. <td>
  197. <a class="viewInf ">查看 </a>
  198. <a class="updateInf ">修改 </a>
  199. </td>
  200. </tr>
  201. <tr class="trHover">
  202. <td> <input type="checkbox"> </td>
  203. <td class="stuSequence">1 </td>
  204. <td class="stuId">11503080210 </td>
  205. <td class="stuName">王小小 </td>
  206. <td class="stuAcademy">应用技术学院 </td>
  207. <td class="stuMajor">修路 </td>
  208. <td class="stuYear">2015 </td>
  209. <td class="stuClass">2 </td>
  210. <td class="stuAge">21 </td>
  211. <td>
  212. <a class="viewInf ">查看 </a>
  213. <a class="updateInf ">修改 </a>
  214. </td>
  215. </tr>
  216. <tr class="trHover">
  217. <td> <input type="checkbox"> </td>
  218. <td class="stuSequence">1 </td>
  219. <td class="stuId">11503080210 </td>
  220. <td class="stuName">张三 </td>
  221. <td class="stuAcademy">计算机科学与工程学院 </td>
  222. <td class="stuMajor">软件工程 </td>
  223. <td class="stuYear">2015 </td>
  224. <td class="stuClass">2 </td>
  225. <td class="stuAge">21 </td>
  226. <td>
  227. <a class="viewInf ">查看 </a>
  228. <a class="updateInf ">修改 </a>
  229. </td>
  230. </tr>
  231. <tr class="trHover">
  232. <td> <input type="checkbox"> </td>
  233. <td class="stuSequence">1 </td>
  234. <td class="stuId">11503080210 </td>
  235. <td class="stuName">李四 </td>
  236. <td class="stuAcademy">会计学院 </td>
  237. <td class="stuMajor">会计学 </td>
  238. <td class="stuYear">2015 </td>
  239. <td class="stuClass">2 </td>
  240. <td class="stuAge">19 </td>
  241. <td>
  242. <a class="viewInf ">查看 </a>
  243. <a class="updateInf ">修改 </a>
  244. </td>
  245. </tr>
  246. <tr class="trHover">
  247. <td> <input type="checkbox"> </td>
  248. <td class="stuSequence">1 </td>
  249. <td class="stuId">11503080210 </td>
  250. <td class="stuName">王五 </td>
  251. <td class="stuAcademy">理学院 </td>
  252. <td class="stuMajor">软件工程 </td>
  253. <td class="stuYear">2015 </td>
  254. <td class="stuClass">2 </td>
  255. <td class="stuAge">18 </td>
  256. <td>
  257. <a class="viewInf ">查看 </a>
  258. <a class="updateInf ">修改 </a>
  259. </td>
  260. </tr>
  261. <tr class="trHover">
  262. <td> <input type="checkbox"> </td>
  263. <td class="stuSequence">1 </td>
  264. <td class="stuId">11503080210 </td>
  265. <td class="stuName">赵六 </td>
  266. <td class="stuAcademy">理学院 </td>
  267. <td class="stuMajor">软件工程 </td>
  268. <td class="stuYear">2000 </td>
  269. <td class="stuClass">6 </td>
  270. <td class="stuAge">21 </td>
  271. <td>
  272. <a class="viewInf ">查看 </a>
  273. <a class="updateInf ">修改 </a>
  274. </td>
  275. </tr>
  276. <tr class="trHover">
  277. <td> <input type="checkbox"> </td>
  278. <td class="stuSequence">1 </td>
  279. <td class="stuId">11503080210 </td>
  280. <td class="stuName">张三 </td>
  281. <td class="stuAcademy">计算机科学与工程学院 </td>
  282. <td class="stuMajor">软件工程 </td>
  283. <td class="stuYear">2015 </td>
  284. <td class="stuClass">2 </td>
  285. <td class="stuAge">21 </td>
  286. <td>
  287. <a class="viewInf ">查看 </a>
  288. <a class="updateInf ">修改 </a>
  289. </td>
  290. </tr>
  291. <tr class="trHover">
  292. <td> <input type="checkbox"> </td>
  293. <td class="stuSequence">1 </td>
  294. <td class="stuId">11503080210 </td>
  295. <td class="stuName">李四 </td>
  296. <td class="stuAcademy">会计学院 </td>
  297. <td class="stuMajor">会计学 </td>
  298. <td class="stuYear">2015 </td>
  299. <td class="stuClass">2 </td>
  300. <td class="stuAge">19 </td>
  301. <td>
  302. <a class="viewInf ">查看 </a>
  303. <a class="updateInf ">修改 </a>
  304. </td>
  305. </tr>
  306. <tr class="trHover">
  307. <td> <input type="checkbox"> </td>
  308. <td class="stuSequence">1 </td>
  309. <td class="stuId">11503080210 </td>
  310. <td class="stuName">王五 </td>
  311. <td class="stuAcademy">理学院 </td>
  312. <td class="stuMajor">软件工程 </td>
  313. <td class="stuYear">2015 </td>
  314. <td class="stuClass">2 </td>
  315. <td class="stuAge">18 </td>
  316. <td>
  317. <a class="viewInf ">查看 </a>
  318. <a class="updateInf ">修改 </a>
  319. </td>
  320. </tr>
  321. <tr class="trHover">
  322. <td> <input type="checkbox"> </td>
  323. <td class="stuSequence">1 </td>
  324. <td class="stuId">11503080210 </td>
  325. <td class="stuName">赵六 </td>
  326. <td class="stuAcademy">理学院 </td>
  327. <td class="stuMajor">软件工程 </td>
  328. <td class="stuYear">2000 </td>
  329. <td class="stuClass">6 </td>
  330. <td class="stuAge">21 </td>
  331. <td>
  332. <a class="viewInf ">查看 </a>
  333. <a class="updateInf ">修改 </a>
  334. </td>
  335. </tr>
  336. <tr class="trHover">
  337. <td> <input type="checkbox"> </td>
  338. <td class="stuSequence">1 </td>
  339. <td class="stuId">11503080210 </td>
  340. <td class="stuName">张三 </td>
  341. <td class="stuAcademy">计算机科学与工程学院 </td>
  342. <td class="stuMajor">软件工程 </td>
  343. <td class="stuYear">2015 </td>
  344. <td class="stuClass">2 </td>
  345. <td class="stuAge">21 </td>
  346. <td>
  347. <a class="viewInf ">查看 </a>
  348. <a class="updateInf ">修改 </a>
  349. </td>
  350. </tr>
  351. <tr class="trHover">
  352. <td> <input type="checkbox"> </td>
  353. <td class="stuSequence">1 </td>
  354. <td class="stuId">11503080210 </td>
  355. <td class="stuName">李四 </td>
  356. <td class="stuAcademy">会计学院 </td>
  357. <td class="stuMajor">会计学 </td>
  358. <td class="stuYear">2015 </td>
  359. <td class="stuClass">2 </td>
  360. <td class="stuAge">19 </td>
  361. <td>
  362. <a class="viewInf ">查看 </a>
  363. <a class="updateInf ">修改 </a>
  364. </td>
  365. </tr>
  366. <tr class="trHover">
  367. <td> <input type="checkbox"> </td>
  368. <td class="stuSequence">1 </td>
  369. <td class="stuId">11503080210 </td>
  370. <td class="stuName">王五 </td>
  371. <td class="stuAcademy">理学院 </td>
  372. <td class="stuMajor">软件工程 </td>
  373. <td class="stuYear">2015 </td>
  374. <td class="stuClass">2 </td>
  375. <td class="stuAge">18 </td>
  376. <td>
  377. <a class="viewInf ">查看 </a>
  378. <a class="updateInf ">修改 </a>
  379. </td>
  380. </tr>
  381. <tr class="trHover">
  382. <td> <input type="checkbox"> </td>
  383. <td class="stuSequence">1 </td>
  384. <td class="stuId">11503080210 </td>
  385. <td class="stuName">赵六 </td>
  386. <td class="stuAcademy">理学院 </td>
  387. <td class="stuMajor">软件工程 </td>
  388. <td class="stuYear">2000 </td>
  389. <td class="stuClass">6 </td>
  390. <td class="stuAge">21 </td>
  391. <td>
  392. <a class="viewInf ">查看 </a>
  393. <a class="updateInf ">修改 </a>
  394. </td>
  395. </tr>
  396. <tr class="trHover">
  397. <td> <input type="checkbox"> </td>
  398. <td class="stuSequence">1 </td>
  399. <td class="stuId">11503080210 </td>
  400. <td class="stuName">张三 </td>
  401. <td class="stuAcademy">计算机科学与工程学院 </td>
  402. <td class="stuMajor">软件工程 </td>
  403. <td class="stuYear">2015 </td>
  404. <td class="stuClass">2 </td>
  405. <td class="stuAge">21 </td>
  406. <td>
  407. <a class="viewInf ">查看 </a>
  408. <a class="updateInf ">修改 </a>
  409. </td>
  410. </tr>
  411. <tr class="trHover">
  412. <td> <input type="checkbox"> </td>
  413. <td class="stuSequence">1 </td>
  414. <td class="stuId">11503080210 </td>
  415. <td class="stuName">李四 </td>
  416. <td class="stuAcademy">会计学院 </td>
  417. <td class="stuMajor">会计学 </td>
  418. <td class="stuYear">2015 </td>
  419. <td class="stuClass">2 </td>
  420. <td class="stuAge">19 </td>
  421. <td>
  422. <a class="viewInf ">查看 </a>
  423. <a class="updateInf ">修改 </a>
  424. </td>
  425. </tr>
  426. <tr class="trHover">
  427. <td> <input type="checkbox"> </td>
  428. <td class="stuSequence">1 </td>
  429. <td class="stuId">11503080210 </td>
  430. <td class="stuName">王五 </td>
  431. <td class="stuAcademy">理学院 </td>
  432. <td class="stuMajor">软件工程 </td>
  433. <td class="stuYear">2015 </td>
  434. <td class="stuClass">2 </td>
  435. <td class="stuAge">18 </td>
  436. <td>
  437. <a class="viewInf ">查看 </a>
  438. <a class="updateInf ">修改 </a>
  439. </td>
  440. </tr>
  441. <tr class="trHover">
  442. <td> <input type="checkbox"> </td>
  443. <td class="stuSequence">1 </td>
  444. <td class="stuId">11503080210 </td>
  445. <td class="stuName">赵六 </td>
  446. <td class="stuAcademy">理学院 </td>
  447. <td class="stuMajor">软件工程 </td>
  448. <td class="stuYear">2000 </td>
  449. <td class="stuClass">6 </td>
  450. <td class="stuAge">21 </td>
  451. <td>
  452. <a class="viewInf ">查看 </a>
  453. <a class="updateInf ">修改 </a>
  454. </td>
  455. </tr>
  456. </tbody>
  457. <tfoot>
  458. <!-- <tr>-->
  459. <!-- <td colspan="4">-->
  460. <!-- <button class="delbtn ">删除</button>-->
  461. <!-- -->
  462. <!-- </td>-->
  463. <!-- </tr>-->
  464. </tfoot>
  465. </tbody>
  466. </table>
  467. <!--增加的模态框-->
  468. <div class="modal addfade" id="addmodal">
  469. <div class="modal-dialog">
  470. <div class="modal-content">
  471. <div class="modal-header">
  472. <i>X </i>
  473. <h4>新增学生信息 </h4>
  474. </div>
  475. <div class="modal-body">
  476. <p>
  477. 序号: <input type="text" />
  478. </p>
  479. <p>
  480. 学号: <input type="text" />
  481. </p>
  482. <p>
  483. 姓名: <input type="text" />
  484. </p>
  485. <p>
  486. 学院: <input type="text" />
  487. </p>
  488. <p>
  489. 专业: <input type="text" />
  490. </p>
  491. <p>
  492. 年级: <input type="text" />
  493. </p>
  494. <p>
  495. 班级: <input type="text" />
  496. </p>
  497. <p>
  498. 年龄: <input type="text" />
  499. </p>
  500. </div>
  501. <div class="modal-footer">
  502. <div class="pageInfoBox"> </div>
  503. <button class="addButton_ok">确定 </button>
  504. <button class="addButton_no">取消 </button>
  505. </div>
  506. </div>
  507. </div>
  508. </div>
  509. <!--修改的模态框-->
  510. <div class="modal movefade movemodal" id="movemodal">
  511. <div class="modal-dialog">
  512. <div class="modal-content">
  513. <div class="modal-header">
  514. <i>X </i>
  515. <h4>修改学生信息 </h4>
  516. </div>
  517. <div class="modal-body">
  518. <p>
  519. 序号: <input type="text" />
  520. </p>
  521. <p>
  522. 学号: <input type="text" />
  523. </p>
  524. <p>
  525. 姓名: <input type="text" />
  526. </p>
  527. <p>
  528. 学院: <input type="text" />
  529. </p>
  530. <p>
  531. 专业: <input type="text" />
  532. </p>
  533. <p>
  534. 年级: <input type="text" />
  535. </p>
  536. <p>
  537. 班级: <input type="text" />
  538. </p>
  539. <p>
  540. 年龄: <input type="text" />
  541. </p>
  542. </div>
  543. <div class="modal-footer">
  544. <button class="updatabtn_ok">保存 </button>
  545. <button class="updatabtn_no">取消 </button>
  546. </div>
  547. </div>
  548. </div>
  549. </div>
  550. <!--查看的模态框-->
  551. <div class="modal viewfade" id="viewmodal">
  552. <div class="modal-dialog">
  553. <div class="modal-content">
  554. <div class="modal-header">
  555. <i>X </i>
  556. <h4>查看学生信息 </h4>
  557. </div>
  558. <div class="modal-body">
  559. <p>
  560. 序号: <input type="text" class="viewStyle" disabled="disabled" />
  561. </p>
  562. <p>
  563. 学号: <input type="text" />
  564. </p>
  565. <p>
  566. 姓名: <input type="text" />
  567. </p>
  568. <p>
  569. 学院: <input type="text" />
  570. </p>
  571. <p>
  572. 专业: <input type="text" />
  573. </p>
  574. <p>
  575. 年级: <input type="text" />
  576. </p>
  577. <p>
  578. 班级: <input type="text" />
  579. </p>
  580. <p>
  581. 年龄: <input type="text" />
  582. </p>
  583. </div>
  584. <div class="modal-footer">
  585. <button class="addButton_no">取消 </button>
  586. </div>
  587. </div>
  588. </div>
  589. </div>
  590. </div>
  591. <div class="footer">
  592. <div class="pageInformation">
  593. <span id="curPage"> </span>页,
  594. <span id="countPage"> </span>条,(每页显示10条)
  595. <input id="page" type="text"style="display: none" >
  596. </div>
  597. <div class="pageButton">
  598. <button id="prePageButton">上一页 </button>
  599. <button id="nextPageButton">下一页 </button>
  600. </div>
  601. </div>
  602. </div>
  603. <script src="js/jquery.min.js"> </script>
  604. <script src="js/studentInformationManage.js"> </script>
  605. </body>
  606. </html>

  
  1. *{
  2. margin: 0;
  3. padding: 0;
  4. }
  5. .wrapperBox{
  6. width: 1229px;
  7. height: 645px;
  8. background-color: #f0ece9 ;
  9. margin: 0 auto;
  10. }
  11. .header{
  12. width: 1200px;
  13. height: 111px;
  14. margin: 0 auto;
  15. }
  16. .headerTitle{
  17. width: 1200px;
  18. height: 56px;
  19. }
  20. .headerButton{
  21. width: 205px;
  22. height: 40px;
  23. line-height: 40px;
  24. }
  25. .container{
  26. width: 1200px;
  27. height: 455px;
  28. margin: 0 auto;
  29. font-size: 12px;
  30. text-align: center;
  31. }
  32. .footer{
  33. width: 1200px;
  34. height: 79px;
  35. margin: 0 auto;
  36. }
  37. /*.pageInformation{*/
  38. /* width: 226px;*/
  39. /* height: 79px;*/
  40. /* background-color: blue;*/
  41. /* float: left;*/
  42. /*}*/
  43. /**/
  44. .pageButton{
  45. width: 190px;
  46. height: 79px;
  47. line-height: 79px;
  48. float: right;
  49. }
  50. .addButton{
  51. width: 93px;
  52. height: 38px;
  53. background-color: #5cb85c;
  54. border: 1px solid #000000;
  55. color: #fff;
  56. cursor: pointer;
  57. }
  58. #deleteButton{
  59. width: 93px;
  60. height: 38px;
  61. background-color: #d9534f;
  62. border: 1px solid #000000;
  63. color: #fff;
  64. margin-left: 14px;
  65. cursor: pointer;
  66. }
  67. #prePageButton{
  68. width: 88px;
  69. height: 38px;
  70. background-color: #5cb85c;
  71. border: 1px solid #000000;
  72. color: #fff;
  73. cursor: pointer;
  74. }
  75. #nextPageButton{
  76. width: 88px;
  77. height: 38px;
  78. background-color: #d9534f;
  79. border: 1px solid #000000;
  80. margin-left: 9px;
  81. color: #fff;
  82. cursor: pointer;
  83. }
  84. .viewInf , .updateInf{
  85. color: #ff0000;
  86. cursor: pointer;
  87. }
  88. .updateInf{
  89. margin-left: 9px;
  90. }
  91. .container table{
  92. border-collapse: collapse;
  93. width: 100%;
  94. }
  95. .container td{
  96. height: 40px;
  97. }
  98. .tableHeaher{
  99. height: 55px;
  100. background-color: #dadee1;
  101. }
  102. tr .trHover :hover{
  103. background-color: red;
  104. }
  105. /*headerStyle */
  106. .headerLine{ width: 1200px; color: #999999; text-align: center; font-size: 24px;}
  107. .headerLine :before, .headerLine :after{ content: ""; width: 406px; border-top: 4px #c3a080 solid; display: inline-block;
  108. vertical-align: middle;}
  109. .headerLine :before{ margin-right: 98px;}
  110. .headerLine :after{ margin-left: 98px;}
  111. /*end */
  112. /*cintainerStyle */
  113. i{ font-style: normal;}
  114. td{
  115. height: 40px;
  116. }
  117. #addmodal{
  118. position: fixed;
  119. left: 0px;
  120. top: 0px;
  121. right: 0px;
  122. bottom: 0px;
  123. background: rgba( 0, 0, 0, 0.5);
  124. display: none;
  125. }
  126. #viewmodal{
  127. position: fixed;
  128. left: 0px;
  129. top: 0px;
  130. right: 0px;
  131. bottom: 0px;
  132. background: rgba( 0, 0, 0, 0.5);
  133. display: none;
  134. }
  135. #movemodal{
  136. position: fixed;
  137. left: 0px;
  138. top: 0px;
  139. right: 0px;
  140. bottom: 0px;
  141. background: rgba( 0, 0, 0, 0.5);
  142. display: none;
  143. }
  144. .modal-dialog{
  145. position: relative;
  146. width: 500px;
  147. margin: 0px auto;
  148. background: white;
  149. border-radius: 5px;
  150. }
  151. .modal-header {
  152. border-bottom: 1px solid #e5e5e5;
  153. color: #fff;
  154. background-color: #555;
  155. height: 40px;
  156. line-height: 40px;
  157. padding-left: 20px;
  158. }
  159. .modal-header> i{
  160. font-weight: bold;
  161. color: #ADADAD;
  162. float: right;
  163. cursor: pointer;
  164. }
  165. .modal-body {
  166. position: relative;
  167. text-align: center;
  168. }
  169. .modal-body input{
  170. width: 202px;
  171. border: 1px solid #a9a9a9;
  172. outline: none;
  173. margin: 10px;
  174. }
  175. .modal-footer {
  176. padding: 15px;
  177. text-align: right;
  178. border-top: 1px solid #e5e5e5;
  179. }
  180. .addButton_ok{
  181. width: 93px;
  182. height: 38px;
  183. border-radius: 4px;
  184. background: #5cb85c;
  185. color: #808080;
  186. outline: none;
  187. cursor: pointer;
  188. border: 1px solid #aeaeae;
  189. }
  190. .addButton_no{
  191. width: 93px;
  192. height: 38px;
  193. border-radius: 4px;
  194. background: #fff;
  195. color: #808080;
  196. outline: none;
  197. cursor: pointer;
  198. border: 1px solid #aeaeae;
  199. }
  200. .pageInformation{
  201. width: 226px;
  202. height: 16px;
  203. padding-top: 29px;
  204. font-size: 15px;
  205. line-height: 16px;
  206. float: left;
  207. }
  208. .updatabtn_ok{
  209. width: 93px;
  210. height: 38px;
  211. border-radius: 4px;
  212. background: #fff;
  213. color: #808080;
  214. outline: none;
  215. cursor: pointer;
  216. border: 1px solid #aeaeae;
  217. }
  218. .updatabtn_no{
  219. width: 93px;
  220. height: 38px;
  221. border-radius: 4px;
  222. background: #fff;
  223. color: #808080;
  224. outline: none;
  225. cursor: pointer;
  226. border: 1px solid #aeaeae;
  227. }

  
  1. /*全选功能*/
  2. $( 'table th input:checkbox').on( 'click', function(){
  3. var that = this;
  4. $( this).closest( 'table').find( 'tr > td:first-child input:checkbox')
  5. .each( function(){
  6. this.checked = that.checked;
  7. $( this).closest( 'tr').toggleClass( 'selected');
  8. });
  9. });
  10. /*end*/
  11. //表格操作
  12. $( function(){
  13. //Add
  14. var arrAdd=[]
  15. $( document).on( "click", ".addButton", function(){
  16. $( ".addfade").fadeIn( 0)
  17. })
  18. //addArray
  19. $( document).on( "click", ".addButton_ok", function(){
  20. $( ".addfade").fadeOut( 0)
  21. arrAdd=[]
  22. $( '#addmodal').find( "input").each( function(){
  23. arrAdd.push($( this).val())
  24. });
  25. var str= '<tr>' +
  26. '<td><input type="checkbox"></td>' +
  27. '<td class="stuSequence">'+arrAdd[ 0]+ '</td>' +
  28. '<td class="stuId">'+arrAdd[ 1]+ '</td>' +
  29. '<td class="stuName">'+arrAdd[ 2]+ '</td>' +
  30. '<td class="stuAcademy">'+arrAdd[ 3]+ '</td>' +
  31. '<td class="stuMajor">'+arrAdd[ 4]+ '</td>' +
  32. '<td class="stuYear">'+arrAdd[ 5]+ '</td>' +
  33. '<td class="stuClass">'+arrAdd[ 6]+ '</td>' +
  34. '<td class="stuAge">'+arrAdd[ 7]+ '</td>' +
  35. '<td>' + '<a class="viewInf ">查看</a> <a class="updateInf ">修改</a></td>' +
  36. '</tr>'
  37. $( "tbody").append(str)
  38. //奇偶行的颜色不同
  39. $( "tr:odd").css( "background-color", "#fff");
  40. $( "tr:even").css( "background-color", "#eef1f8");
  41. //end
  42. //颜色选择变化
  43. var trEven = $( "#tdata tr:even");
  44. trEven.mouseover( function () {
  45. $( this).css( "background-color", "#AEF2E5");
  46. $( this).children( "td").css( "background-color", "#AEF2E5");
  47. }).mouseout( function () {
  48. $( this).css( "background-color", "#FFFFFF");
  49. $( this).children( "td").css( "background-color", "#FFFFFF");
  50. });
  51. var trOdd = $( "#tdata tr:odd");
  52. trOdd.mouseover( function () {
  53. $( this).css( "background-color", "#AEF2E5");
  54. $( this).children( "td").css( "background-color", "#AEF2E5");
  55. }).mouseout( function () {
  56. $( this).css( "background-color", "#eef1f8");
  57. $( this).children( "td").css( "background-color", "#eef1f8");
  58. });
  59. //end
  60. $( '#addmodal').find( "input").val( '')
  61. })
  62. $( document).on( "click", ".addButton_no", function(){
  63. $( ".addfade").fadeOut( 0)
  64. })
  65. $( document).on( "click", ".modal-header i", function(){
  66. $( ".addfade").fadeOut( 0)
  67. })
  68. //delete
  69. var del=[]
  70. $( document).on( "click", ".delbtn", function(){
  71. del=[]
  72. if(confirm( "确定删除吗?")){
  73. $( this).parents( "tr").fadeOut( 0)
  74. }
  75. })
  76. //updateShow
  77. var arrMove=[];
  78. var _this = null ;
  79. $( document).on( "click", ".updateInf", function(){
  80. arrMove=[]
  81. _this=$( this).parents( "tr")
  82. $( ".movefade").fadeIn( 0)
  83. $( this).parent().siblings().each( function(){
  84. arrMove.push($( this).next().text())
  85. })
  86. $( this).parents().find( '.movemodal input').each( function(i){
  87. $( this).val(arrMove[i])
  88. })
  89. })
  90. //updateBtn
  91. $( document).on( "click", ".updatabtn_ok", function(){
  92. arrMove=[]
  93. $( this).parent().siblings().find( 'input').each( function(){
  94. arrMove.push($( this).val())
  95. console.log($( this))
  96. })
  97. console.log(arrMove)
  98. $( this).parents().find( '.movemodal input').each( function(i){
  99. $( this).val(arrMove[i+ 1])
  100. })
  101. _this.find( "td").next().each( function(i){
  102. $( this).text(arrMove[i])
  103. })
  104. $( ".movefade").fadeOut( 0)
  105. })
  106. //updateCancel
  107. $( document).on( "click", ".updatabtn_no", function(){
  108. $( ".movefade").fadeOut( 0)
  109. })
  110. $( document).on( "click", ".modal-header i", function(){
  111. $( ".movefade").fadeOut( 0)
  112. })
  113. //view
  114. var arrView=[];
  115. var _thisView = null ;
  116. $( document).on( "click", ".viewInf", function(){
  117. arrMove=[]
  118. _thisView=$( this).parents( "tr")
  119. $( ".viewfade").fadeIn( 0)
  120. $( this).parent().siblings().each( function(){
  121. arrView.push($( this).next().text())
  122. })
  123. $( this).parents().find( '#viewmodal input').each( function(i){
  124. $( this).val(arrView[i]).attr( "disabled", "disabled");
  125. })
  126. })
  127. //viewCancel
  128. $( document).on( "click", ".addButton_no", function(){
  129. $( ".viewfade").fadeOut( 0)
  130. })
  131. $( document).on( "click", ".modal-header i", function(){
  132. $( ".viewfade").fadeOut( 0)
  133. })
  134. })
  135. //单数行和多数行背景色设置
  136. $( document).ready( function(){
  137. $( "tr:odd").css( "background-color", "#fff");
  138. $( "tr:even").css( "background-color", "#eef1f8");
  139. });
  140. //改变tr的背景颜色
  141. $( function () {
  142. var trEven = $( "#tdata tr:even");
  143. trEven.mouseover( function () {
  144. $( this).css( "background-color", "#AEF2E5");
  145. $( this).children( "td").css( "background-color", "#AEF2E5");
  146. }).mouseout( function () {
  147. $( this).css( "background-color", "#FFFFFF");
  148. $( this).children( "td").css( "background-color", "#FFFFFF");
  149. });
  150. var trOdd = $( "#tdata tr:odd");
  151. trOdd.mouseover( function () {
  152. $( this).css( "background-color", "#AEF2E5");
  153. $( this).children( "td").css( "background-color", "#AEF2E5");
  154. }).mouseout( function () {
  155. $( this).css( "background-color", "#eef1f8");
  156. $( this).children( "td").css( "background-color", "#eef1f8");
  157. });
  158. });
  159. //end
  160. //多选框删除
  161. $( function(){
  162. // var cit= $("#containerTable");
  163. // if(cit.size()>0) {
  164. // cit.find("tr:not(:first)").remove();
  165. //
  166. // }
  167. $( "#deleteButton").click( function() {
  168. $( "input:checked").each( function() { // 遍历选中的checkbox
  169. n = $( this).parents( "tr").index(); // 获取checkbox所在行的顺序
  170. $( "table#containerTable").find( ".trHover:eq("+n+ ")").remove();
  171. });
  172. });
  173. });
  174. //end
  175. //翻页功能
  176. //table分页
  177. var pageSize= 10; //每页显示的记录条数
  178. var curPage= 0; //显示第curPage页
  179. var len; //总行数
  180. var page; //总页数
  181. $( function(){
  182. len =$( "#containerTable tr").length -1; //去掉表头
  183. page=len % pageSize== 0 ? len/pageSize : Math.floor(len/pageSize)+ 1; //根据记录条数,计算页数
  184. console.log( "len:"+len+ "page:"+page);
  185. document.getElementById( "page").value=page;
  186. curPage= 1;
  187. displayPage(); //显示第一页
  188. $( "#nextPageButton").click( function(){ //下一页
  189. if(curPage<page){
  190. curPage+= 1;
  191. }
  192. else{
  193. alert( "已经是最后一页了")
  194. }
  195. displayPage();
  196. });
  197. $( "#prePageButton").click( function(){ //上一页
  198. if(curPage> 1){
  199. curPage-= 1;
  200. }
  201. else{
  202. alert( "已经是第一页了不能再翻了");
  203. }
  204. displayPage();
  205. });
  206. });
  207. function displayPage(){
  208. var begin=(curPage -1)*pageSize; //起始记录号
  209. var end = begin + pageSize;
  210. console.log( " begin:"+len+ " end:"+end);
  211. if(end > len ) end=len;
  212. $( "#tdata tr").hide();
  213. $( "#containerTable tr").each( function(i){
  214. if(i -1>=begin && i -1<end) //显示第page页的记录
  215. {
  216. $( "#containerTable_one").show();
  217. $( this).show();
  218. document.getElementById( "curPage").innerHTML=curPage;
  219. document.getElementById( "countPage").innerHTML = len;
  220. }
  221. });
  222. }
  223. function pageSize2(){
  224. curPage= 0; //显示第curPage页
  225. pageSize= parseInt( document.getElementById( "pageSize").value);
  226. len =$( "#containerTable tr").length -1; //去掉表头
  227. page=len % pageSize== 0 ? len/pageSize : Math.floor(len/pageSize)+ 1; //根据记录条数,计算页数
  228. console.log( "len:"+len+ " page:"+page);
  229. document.getElementById( "page").value=page;
  230. curPage= 1;
  231. displayPage(); //显示第一页
  232. }
  233. //end

最后github上的源码


转载:https://blog.csdn.net/Y920036515/article/details/103816379
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场