获取行号:td_object.parentNode.rowIndex
获取列号:td_object.cellIndex
var arr = $("#timetable td:not(:eq(0))").siblings(".fous");//获取具有fous样式的td袁元素
$.each(arr,function(n,value) {
alert(value.parentNode.rowIndex+' '+value.cellIndex);
});
01 |
<meta
http-equiv= "Content-Type" content= "text/html;
charset=UTF-8" /> |
02 |
<div
style= "text-align:center;margin-top:200px;" > |
03 |
<TABLE
bgColor=yellow border=2> |
06 |
<TD
onclick=alert( this .cellIndex)>获取所在的列数</TD> |
07 |
<TD
onclick=alert( this .parentNode.rowIndex)>获取所在的行数</TD> |
10 |
<TD
onclick=alert( this .parentNode.rowIndex)>获取所在的行数</TD> |
11 |
<TD
onclick=alert( this .cellIndex)>获取所在的列数</TD> |