已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
表格中点击单元格,选中所在的行及列,并改变样式body margin:0; padding:0; background:#f1f1f1; color:#555; line-height:150%; text-align:left; a text-decoration:none; color:#057fac; a:hover text-decoration:none; color:#999; h1 font-size:140%; margin:0 20px; line-height:80px; #container margin:0 auto; width:680px;#content margin:0 20px; table, tdfont:88% Arial, Helvetica, sans-serif; tablewidth:100%;border-collapse:collapse;margin:1em 0;th, tdtext-align:center;padding:0.5em;border:1px solid #fff;thbackground:#328aa4 url(tr_back.gif) repeat-x;color:#fff;tdbackground:#e5f1f4;/* tablecloth styles */tr.even tdbackground:#e5f1f4;tr.odd tdbackground:#f8fbfc;th.over, tr.even th.over, tr.odd th.overbackground:#4a98af;th.down, tr.even th.down, tr.odd th.downbackground:#bce774;th.selected, tr.even th.selected, tr.odd th.selectedtd.over, tr.even td.over, tr.odd td.overbackground:#ecfbd4;td.down, tr.even td.down, tr.odd td.downbackground:#bce774;color:#fff;td.selected, tr.even td.selected, tr.odd td.selectedbackground:#bce774;color:#555;/* use this if you want to apply different styleing to empty table cells*/td.empty, tr.odd td.empty, tr.even td.emptybackground:#fff;this.tablecloth = function()/ CONFIG / if set to true then mouseover a table cell will highlight entire column (except sibling headings)var highlightCols = true;/ if set to true then mouseover a table cell will highlight entire row(except sibling headings)var highlightRows = true;/ if set to true then click on a table sell will select row or column based on configvar selectable = true;/ this function is called when / add your own code if you want to add action / function receives object that has been clicked this.clickAction = function(obj)/alert(obj.innerHTML);/ END CONFIG (do not edit below this line)var tableover = false;this.start = function()var tables = document.getElementsByTagName(table);for (var i=0;itables.length;i+)tablesi.onmouseover = function()tableover = true;tablesi.onmouseout = function()tableover = false;rows(tablesi);this.rows = function(table)var css = ;var tr = table.getElementsByTagName(tr);for (var i=0;itr.length;i+)css = (css = odd) ? even : odd;tri.className = css;var arr = new Array();for(var j=0;jtri.childNodes.length;j+)if(tri.childNodesj.nodeType = 1) arr.push(tri.childNodesj);for (var j=0;jarr.length;j+)arrj.row = i;arrj.col = j;if(arrj.innerHTML = | arrj.innerHTML = ) arrj.className += empty;arrj.css = arrj.className;arrj.onmouseover = function()over(table,this,this.row,this.col);arrj.onmouseout = function()out(table,this,this.row,this.col);arrj.onmousedown = function()down(table,this,this.row,this.col);arrj.onmouseup = function()up(table,this,this.row,this.col);arrj.onclick = function()click(table,this,this.row,this.col);/ appyling mouseover state for objects (th or td)this.over = function(table,obj,row,col)if (!highlightCols & !highlightRows) obj.className = obj.css + over; if(check1(obj,col)if(highlightCols) highlightCol(table,obj,col);if(highlightRows) highlightRow(table,obj,row);/ appyling mouseout state for objects (th or td)this.out = function(table,obj,row,col)if (!highlightCols & !highlightRows) obj.className = obj.css; unhighlightCol(table,col);unhighlightRow(table,row);/ appyling mousedown state for objects (th or td)this.down = function(table,obj,row,col)obj.className = obj.css + down; ;/ appyling mouseup state for objects (th or td)this.up = function(table,obj,row,col)obj.className = obj.css + over; ;/ onclick event for objects (th or td)this.click = function(table,obj,row,col)if(check1)if(selectable) unselect(table);if(highlightCols) highlightCol(table,obj,col,true);if(highlightRows) highlightRow(table,obj,row,true);document.onclick = unselectAll;clickAction(obj); ;this.highlightCol = function(table,active,col,sel)var css = (typeof(sel) != undefined) ? selected : over;var tr = table.getElementsByTagName(tr);for (var i=0;itr.length;i+)var arr = new Array();for(j=0;jtri.childNodes.length;j+)if(tri.childNodesj.nodeType = 1) arr.push(tri.childNodesj);var obj = arrcol;if (check2(active,obj) & check3(obj) obj.className = obj.css + + css; ;this.unhighlightCol = function(table,col)var tr = table.getElementsByTagName(tr);for (var i=0;itr.length;i+)var arr = new Array();for(j=0;jtri.childNodes.length;j+)if(tri.childNodesj.nodeType = 1) arr.push(tri.childNodesj);var obj = arrcol;if(check3(obj) obj.className = obj.css; ;this.highlightRow = function(table,active,row,sel)var css = (typeof(sel) != undefined) ? selected : over;var tr = table.getElementsByTagName(tr)row;for (var i=0;itr.childNodes.length;i+)var obj = tr.childNodesi;if (check2(active,obj) & check3(obj) obj.className = obj.css + + css; ;this.unhighlightRow = function(table,row)var tr = table.getElementsByTagName(tr)row;for (var i=0;itr.childNodes.length;i+)var obj = tr.childNodesi;if(check3(obj) obj.className = obj.css; ;this.unselect = function(table)tr = table.getElementsByTagName(tr)for (var i=0;itr.length;i+)for (var j=0;jtri.childNodes.length;j+)var obj = tri.childNodesj;if(obj.className) obj.className = obj.className.replace(selected,);this.unselectAll = function()if(!tableover)tables = document.getElementsByTagName(table);for (var i=0;itables.length;i+)unselect(tablesi);this.check1 = function(obj,col)return (!(col = 0 & obj.className.indexOf(empty) != -1);this.check2 = function(active,obj)return (!(active.tagName = TH & obj.tagName = TH); ;this.check3 = function(obj)return (obj.className) ? (obj.className.indexOf(selected) = -1) : true; ;start();/* script initiates on page load. */
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年四川安全员-B证考试题库附答案
- 市场监督管理合同示范文本
- 2025年广西事业单位招聘考试真题及答案解析
- 实习学生自我鉴定
- 知识改变命运的课件
- 应急普法知识竞赛试题及答案
- 度江西省招聘村居后备干部考试参考试题及答案
- 开学第一课主题班会(3篇)
- 执业医师考核公共卫生模拟试题1
- 幼儿园中班安全课件下载
- 反脑控的最佳解决方法
- Excel数据录入课件
- 招标评委管理办法
- 2025年plc大赛试题及答案
- 急性阑尾炎伴有弥漫性腹膜炎的护理查房
- 环境礼仪培训课件
- +2.2+更好发挥政府作用高中政治统编版必修二经济与社会+
- 十五五林业草原发展规划纲要
- 农户生计韧性的新挑战与应对策略
- GB/T 12406-2022表示货币的代码
- WPS图文并茂技巧2025年考试要点试题及答案
评论
0/150
提交评论