




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 智慧社区智慧养老与关怀系统
- 禽常见病的尸体剖检
- 热导蛋白技术讲解
- 军营招聘面试题库:涵盖多个职业领域的深度解析
- 终身学习理念下的职业教育
- 需避光输注的药物管理规范
- 餐饮培训资料管理礼仪流程制度
- 细胞储存技术及应用解析
- 星舰结构图讲解
- 系统物理图讲解
- 知识题库-人社劳动知识竞赛测试题及答案(十五)
- 中国历史地理概况智慧树知到期末考试答案章节答案2024年复旦大学
- 越野赛道计划书
- DR002012 NE系列路由器路由协议故障处理 ISSUE 1.00
- 幻觉妄想的护理诊断及护理
- 2024年福建泉州水务集团有限公司招聘笔试参考题库附带答案详解
- 社区团购团长起号流程
- 安徽省高速公路施工标准化指南
- 国网超市化招标评标自动计算表(区间复合平均价法)
- GB/T 21218-2023电气用未使用过的硅绝缘液体
- 2023电赛综合测评报告
评论
0/150
提交评论