资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
JavaScript 表格高亮类的应用[高级]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>表格高亮</title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <style type="text/css"> * { font-size: 11px; font-family: verdana, arial, sans-serif; } table { border: 1px solid #ccc; margin: 0 auto; } th { background-color: #f7f7f7; } td, th { padding: 15px; border: 1px solid #ccc; } tr.alternate { background-color: #efd; } .bold { font-weight: bold; } .red { color: red; font-weight: bold; } .blue { background-color: blue; } /* Used with crosshairs.js */ .hoverHilight { background-color: #ffffc0; cursor: pointer; } .activeCellHilight { background-color: #c0dbff; color: blue; } </style> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2FJavaScript%22%3E%20%0D%0A%20%20%20%20var%20hilightClass%20%3D%20%22hoverHilight%22%3B%20%0D%0Avar%20activeHilightClass%20%3D%20%22activeCellHilight%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0Avar%20hilightActive%20%3D%201%3B%20%0D%0Avar%20hilightCol%20%3D%201%3B%20%0D%0Avar%20hilightRow%20%3D%201%3B%20%0D%0Avar%20hilightTopHeader%20%3D%200%3B%20%0D%0Avar%20hilightLeftHeader%20%3D%200%3B%20%0D%0Avar%20hilightRightHeader%20%3D%200%3B%20%0D%0Avar%20hilightBottomHeader%20%3D%200%3B%20%0D%0Avar%20surroundActive%20%3D%200%3B%20%20%20%20%20%0D%0Afunction%20initCrossHairsTable(id%2C%20topPad%2C%20rightPad%2C%20bottomPad%2C%20leftPad)%20%7B%20%0D%0A%20%20%20%20var%20tableObj%20%3D%20document.getElementById(id)%3B%20%0D%0A%20%20%20%20var%20c%20%3D%20tableObj.rows%5B0%5D.cells.length%20-%20rightPad%3B%20%0D%0A%20%20%20%20var%20r%20%3D%20tableObj.rows.length%20-%20bottomPad%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20for%20(var%20i%20%3D%20topPad%3B%20i%20%3C%20r%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20for%20(var%20j%20%3D%20leftPad%3B%20j%20%3C%20c%3B%20j%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(!document.all)%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20tableObj.rows%5Bi%5D.cells%5Bj%5D.setAttribute(%22onmouseover%22%2C%22addHilight(this)%3B%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20tableObj.rows%5Bi%5D.cells%5Bj%5D.setAttribute(%22onmouseout%22%2C%22removeHilight(this)%3B%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20tableObj.rows%5Bi%5D.cells%5Bj%5D.onmouseover%20%3D%20function()%20%7B%20addHilight(this)%3B%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20tableObj.rows%5Bi%5D.cells%5Bj%5D.onmouseout%20%3D%20function()%20%7B%20removeHilight(this)%3B%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0Afunction%20addHilight(cell)%20%0D%0A%7B%20%0D%0A%20%20%20%20applyHilight(cell.parentNode.parentNode.parentNode%2C%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cell.parentNode.rowIndex%2C%20cell.cellIndex%2C%201)%3B%20%0D%0A%7D%20%0D%0Afunction%20removeHilight(cell)%20%0D%0A%7B%20%0D%0A%20%20%20%20applyHilight(cell.parentNode.parentNode.parentNode%2C%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cell.parentNode.rowIndex%2C%20cell.cellIndex%2C%200)%3B%20%0D%0A%7D%20%0D%0Avar%20oldRowClasses%20%3D%20%22%22%3B%20%20%20%20%20%0D%0Avar%20oldHeaderClasses%20%3D%20%22%22%3B%20%0D%0Avar%20oldCellClasses%20%3D%20new%20Array()%3B%20%0D%0Afunction%20applyHilight(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20var%20W3CDOM%20%3D%20(document.createElement%20%26%26%20document.getElementsByTagName)%3B%20%0D%0A%20%20%20%20if%20(!W3CDOM)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20alert(%22This%20script%20requires%20W3C%20DOM%20support%22)%20%0D%0A%20%20%20%20%20%20%20%20return%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20if%20(hilightClass%20%3D%3D%20%22%22)%20alert(%22Please%20set%20a%20hilight%20class.%22)%3B%20%0D%0A%20%20%20%20if%20(hilightRow)%20applyHilightRow(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%3B%20%0D%0A%20%20%20%20if%20(hilightCol)%20applyHilightCol(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%3B%20%0D%0A%20%20%20%20if%20(hilightTopHeader)%20applyHilightTopHeader(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%3B%20%0D%0A%20%20%20%20if%20(hilightLeftHeader)%20applyHilightLeftHeader(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%3B%20%0D%0A%20%20%20%20if%20(hilightRightHeader)%20applyHilightRightHeader(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%3B%20%0D%0A%20%20%20%20if%20(hilightBottomHeader)%20applyHilightBottomFooter(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%3B%20%0D%0A%20%20%20%20if%20(hilightActive)%20applyHilightActiveCell(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20if%20(surroundActive)%20applySurroundActiveHilight(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%3B%20%0D%0A%7D%20%0D%0Afunction%20applyHilightLeftHeader(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20var%20classArray%3B%20%0D%0A%20%20%20%20var%20rowClasses%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20if%20(state%20%3D%3D%201)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.cells%5B0%5D.className%20%2B%3D%20%22%20%22%20%2B%20hilightClass%3B%20%20%20%20%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20classArray%20%3D%20obj.rows%5BrowIndex%5D.cells%5B0%5D.className.split(%22%20%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20(classArray.length%20-%201)%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(classArray%5Bi%5D%20!%3D%20%22%22)%20rowClasses%20%2B%3D%20%22%20%22%20%2B%20classArray%5Bi%5D%3B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.cells%5B0%5D.className%20%3D%20rowClasses%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0Afunction%20applyHilightRightHeader(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20var%20classArray%3B%20%0D%0A%20%20%20%20var%20rowClasses%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20if%20(state%20%3D%3D%201)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.cells%5Bobj.rows%5BrowIndex%5D.cells.length-1%5D.className%20%2B%3D%20%22%20%22%20%2B%20hilightClass%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20classArray%20%3D%20obj.rows%5BrowIndex%5D.cells%5Bobj.rows%5BrowIndex%5D.cells.length-1%5D.className.split(%22%20%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20(classArray.length%20-%201)%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(classArray%5Bi%5D%20!%3D%20%22%22)%20rowClasses%20%2B%3D%20%22%20%22%20%2B%20classArray%5Bi%5D%3B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.cells%5Bobj.rows%5BrowIndex%5D.cells.length-1%5D.className%20%3D%20rowClasses%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0Afunction%20applyHilightTopHeader(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20var%20classArray%3B%20%0D%0A%20%20%20%20var%20colClasses%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20if%20(state%20%3D%3D%201)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5B0%5D.cells%5BcolIndex%5D.className%20%2B%3D%20%22%20%22%20%2B%20hilightClass%3B%20%20%20%20%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20classArray%20%3D%20obj.rows%5B0%5D.cells%5BcolIndex%5D.className.split(%22%20%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20(classArray.length%20-%201)%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(classArray%5Bi%5D%20!%3D%20%22%22)%20colClasses%20%2B%3D%20%22%20%22%20%2B%20classArray%5Bi%5D%3B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5B0%5D.cells%5BcolIndex%5D.className%20%3D%20colClasses%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0Afunction%20applyHilightBottomFooter(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20var%20classArray%3B%20%0D%0A%20%20%20%20var%20colClasses%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20if%20(state%20%3D%3D%201)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5Bobj.rows.length-1%5D.cells%5BcolIndex%5D.className%20%2B%3D%20%22%20%22%20%2B%20hilightClass%3B%20%20%20%20%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20classArray%20%3D%20obj.rows%5Bobj.rows.length-1%5D.cells%5BcolIndex%5D.className.split(%22%20%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20(classArray.length%20-%201)%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(classArray%5Bi%5D%20!%3D%20%22%22)%20colClasses%20%2B%3D%20%22%20%22%20%2B%20classArray%5Bi%5D%3B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5Bobj.rows.length-1%5D.cells%5BcolIndex%5D.className%20%3D%20colClasses%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0Afunction%20applyHilightRow(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20if%20(state%20%3D%3D%201)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20oldRowClasses%20%3D%20obj.rows%5BrowIndex%5D.className%3B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.className%20%3D%20hilightClass%3B%20%20%20%20%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.className%20%3D%20oldRowClasses%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0Afunction%20applyHilightCol(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20var%20cellClasses%20%3D%20new%20Array()%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20if%20(state%20%3D%3D%201)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20obj.rows.length%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20cellClasses.push(obj.rows%5Bi%5D.cells%5BcolIndex%5D.className)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20obj.rows%5Bi%5D.cells%5BcolIndex%5D.className%20%2B%3D%20%22%20%22%20%2B%20hilightClass%3B%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20oldCellClasses%20%3D%20cellClasses%3B%20%20%20%20%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20oldCellClasses.reverse()%3B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20obj.rows.length%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20obj.rows%5Bi%5D.cells%5BcolIndex%5D.className%20%3D%20oldCellClasses.pop()%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0A%0D%0Avar%20oldActiveCellClasses%3B%20%0D%0A%0D%0Afunction%20applyHilightActiveCell(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20if%20(state%20%3D%3D%201)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20oldActiveCellClasses%20%3D%20null%3B%20%0D%0A%20%20%20%20%20%20%20%20oldActiveCellClasses%20%3D%20obj.rows%5BrowIndex%5D.cells%5BcolIndex%5D.className%3B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.cells%5BcolIndex%5D.className%20%2B%3D%20%22%20%22%20%2B%20activeHilightClass%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20var%20oldClasses%20%3D%20oldActiveCellClasses.split(%22%20%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.cells%5BcolIndex%5D.className%20%3D%20%22%22%3B%20%0D%0A%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%200%3B%20i%20%3C%20oldClasses.length%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(oldClasses%5Bi%5D%20!%3D%20hilightClass)%20obj.rows%5BrowIndex%5D.cells%5BcolIndex%5D.className%20%2B%3D%20%22%20%22%20%2B%20oldClasses%5Bi%5D%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20oldActiveCellClasses%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20applySurroundActiveHilight(obj%2C%20rowIndex%2C%20colIndex%2C%20state)%20%0D%0A%7B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20var%20surroundRadius%20%3D%201%3B%20%0D%0A%20%20%20%20var%20radiusColor%20%3D%20%22%23c0dbff%22%20%0D%0A%20%20%20%20var%20cell%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20if(!parseInt(surroundRadius))%20return%3B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20if%20(state%20%3D%3D%201)%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%20(rowIndex%20-%20surroundRadius)%3B%20i%20%3C%3D%20(rowIndex%20%2B%20surroundRadius)%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(i%20%3C%200)%20continue%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(!obj.rows%5Bi%5D)%20continue%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20for(var%20j%20%3D%20(colIndex%20-%20surroundRadius)%3B%20j%20%3C%3D%20(colIndex%20%2B%20surroundRadius)%3B%20j%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20(j%20%3C%200)%20continue%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20(!obj.rows%5Bi%5D.cells%5Bj%5D)%20continue%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cell%20%3D%20obj.rows%5Bi%5D.cells%5Bj%5D.style%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cell.backgroundColor%20%3D%20radiusColor%3B%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20cell.opacity%20%3D%20(.5)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20cell.MozOpacity%20%3D%20(.5)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20cell.KhtmlOpacity%20%3D%20(.5)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20cell.filter%20%3D%20%22alpha(opacity%3D50)%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20obj.rows%5BrowIndex%5D.cells%5BcolIndex%5D.style.backgroundColor%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%0D%0A%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%20%3D%20(rowIndex%20-%20surroundRadius)%3B%20i%20%3C%3D%20(rowIndex%20%2B%20surroundRadius)%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(i%20%3C%200)%20continue%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(!obj.rows%5Bi%5D)%20continue%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20for(var%20j%20%3D%20(colIndex%20-%20surroundRadius)%3B%20j%20%3C%3D%20(colIndex%20%2B%20surroundRadius)%3B%20j%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20(j%20%3C%200)%20continue%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20(!obj.rows%5Bi%5D.cells%5Bj%5D)%20continue%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cell%20%3D%20obj.rows%5Bi%5D.cells%5Bj%5D.style%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cell.backgroundColor%20%3D%20%22%22%3B%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20cell.opacity%20%3D%20(1)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20cell.MozOpacity%20%3D%20(1)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20cell.KhtmlOpacity%20%3D%20(1)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20cell.filter%20%3D%20%22alpha(opacity%3D100)%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0A%0D%0A%20%20%20%20%3C%2Fscript%3E"> </head> <body> <table id="crossTable"> <tr> <th> </th> <th>编号</th> <th>姓名</th> <th>地址</th> <th>电话</th> </tr> <tr> <td class="bold">1</td> <td onmouseover="addHilight(this);" onmouseout="removeHilight(this);">a1</td> <td>b1</td> <td>c1</td> <td>d1</td> </tr> <tr class="alternate"> <td class="bold">2</td> <td>a2</td> <td>b2</td> <td>c2</td> <td>d2</td> </tr> <tr> <td class="bold">3</td> <td>a3</td> <td>b3</td> <td>c3</td> <td>d3</td> </tr> <tr class="alternate"> <td class="bold">4</td> <td>a4</td> <td>b4</td> <td>c4</td> <td>d4</td> </tr> <tr> <td class="bold">5</td> <td>a5</td> <td>b5</td> <td>c5</td> <td>d5</td> </tr> </table> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%20%0D%0AinitCrossHairsTable(%22crossTable%22%2C%201%2C%200%2C%200%2C%201)%3B%2F%2F%E6%8E%A7%E5%88%B6%20%0D%0A%3C%2Fscript%3E"> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程