JS实现IE专属表格拖拽功能示例
作者:异步漫步时间:2026-10-24 15:30:16浏览:667
本文提供了一段仅适用于Internet Explorer浏览器的JavaScript表格拖拽排序示例代码。通过引入外部脚本并刷新页面执行,实现表格行的可视拖拽与位置调整,适用于需要特定浏览器兼容性的旧版Web开发场景。
IE浏览器表格拖拽示例代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=gb2312" /> <title>Table Test (I.E. Only)</title> <style type="text/css"> body { overflow: hidden; } .Shadow { color: #FC8331; width: 100%; padding: 3px; font-family: Arial, "宋体"; font-size: 12px; font-weight: normal; line-height: 22px; border-collapse: collapse; border-right: 1px solid #0000; border-top: 1px solid #0000; border-left: 1px solid #0000; border-bottom: 1px solid #0000; } .Grid { background-color: #ffffff; padding: 3px; font-family: Arial, "宋体"; font-size: 12px; font-weight: normal; line-height: 22px; color: #494949; text-decoration: none; border-collapse: collapse; border-right: 1px solid #2A8CBF; border-top: 1px solid #2A8CBF; border-left: 1px solid #2A8CBF; border-bottom: 1px solid #2A8CBF; } .GridHeader { font-family: Arial, "宋体"; font-size: 12px; font-weight: bold; line-height: 23px; border: 1px solid #77ABF2; height: 25px; text-decoration: none; text-align: center; white-space: nowrap; color: #000000; } </style> </head> <body> <table id="table" width="90%" border="1" class="Grid"> <thead class="GridHeader"> <tr bgcolor="cccccc"> <th> <span>姓名</span> </th> <th> <span>性别</span> </th> <th> <span>年龄</span> </th> </tr> </thead> <tbody> <tr> <td> 周周 </td> <td> F </td> <td> 20 </td> </tr> <tr> <td> 达达 </td> <td> M </td> <td> 21 </td> </tr> <tr> <td> 黄宏 </td> <td> M </td> <td> 12 </td> </tr> </tbody> <tfoot> </tfoot> </table> </body> </html> 注意:使用 Ctrl+A 全选内容后,若需引入外部 JavaScript 脚本,必须刷新页面方可使代码生效执行。
作者最新文章
D3.js 比例尺与坐标轴的配置详解
2026-11-05 16:54:46
JavaScript怎么遍历对象的Symbol键和不可枚举属性
2026-11-05 13:13:39
封装一个健壮的JS字符串判空工具函数
2026-11-05 12:16:14
JavaScript合并数组的三种常用方法:concat、扩展运算符与push
2026-11-05 11:22:29
JavaScript立即执行函数(IIFE)是什么及基本语法
2026-11-05 10:51:19
