달력

5

« 2025/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

[출처] http://blog.paran.com/likaco/28578721

function CheckGdSgGubun(){

var lo_this;
 //IE 계열
 if(event) {
  lo_this= window.event.srcElement;
 //none IE 계열
 } else {
  lo_this= window.e.getTarget();
 }
    var li_row_index  = lo_this.parentNode.parentNode.rowIndex;
 }

 <tr><td>

 <input type="buttom" onclick="CheckGdSgGubun()">

</td></tr>

이렇게 하면 onclick이벤트가 일어난 자기 자신의 rowIndex를 볼 수 있다.

 lo_this.parentNode.parentNode.rowIndex    이부분에서 parentNode를 두번 썻는데 이는

tr => td => 속성순서이기 때문에  parent 를 두번호출한것이다.

:
Posted by 상문이