显示鼠标坐标 dn001 2009-06-21 08:38:16 <!-- 把下面代码加到<body>区域中 --> <style> TD{border: 1 solid #000000} .dark{} .light{background-color: #000000; color: #FFFFFF} </style> <script> var now_tr = 0; var can_scroll = false; function document.onkeydown() { if(!can_scroll) return; if(event.keyCode==38) { if(now_tr!=0) { document.body.style.overflowY = "hidden" document.getElementById("the_table").rows(now_tr).className="dark"; now_tr--; document.getElementById("the_table").rows(now_tr).className="light"; } else { document.body.style.overflowY = ""; can_scroll = false; } } if(event.keyCode==40) { if(now_tr!=(document.getElementById("the_table").rows.length-1)) { document.body.style.overflowY = "hidden" document.getElementById("the_table").rows(now_tr).className="dark"; now_tr++; document.getElementById("the_table").rows(now_tr).className="light"; } else { document.body.style.overflowY = ""; can_scroll = false; } } document.getElementById("the_table").rows(now_tr).scrollIntoView(true) } function return_now_tr() { document.body.style.overflowY = "hidden" can_scroll = true; if(event.srcElement.tagName=="TD") { document.getElementById("the_table").rows(now_tr).className="dark"; now_tr = event.srcElement.parentElement.sectionRowIndex; document.getElementById("the_table").rows(now_tr).className="light"; } } </script> <form method="POST" action="javascript:alert('当前提交的是第'+now_tr+'行');" onkeydown="if(event.keyCode==13)this.submit()"> <table id="the_table" border="0" width="100%" onclick="return_now_tr()" ondblclick="this.parentElement.submit();"> <tr class="light"> <td>0</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>1</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>2</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>3</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>4</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>5</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>6</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>7</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr > <td>0</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>1</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>2</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>3</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>4</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>5</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>6</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>7</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr > <td>0</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>1</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>2</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>3</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>4</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>5</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>6</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>7</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr > <td>0</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>1</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>2</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>3</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>4</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>5</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>6</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>7</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr > <td>0</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>1</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>2</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>3</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>4</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>5</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>6</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>7</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> </form>