ภาษาไทย
<!-- 把下的代码加到<body>区域中 --> <style> TD{border: 1 solid #000000} .dark{} .light{สีพื้นหลัง: #000000; สี: #FFFFFF} </style> <script> var now_tr = 0; var can_scroll = เท็จ; ฟังก์ชั่น document.onkeydown() { if(!can_scroll) กลับ; if(event.keyCode==38) { if(now_tr!=0) { document.body.style.overflowY = "ซ่อน" document.getElementById("the_table").rows(now_tr).className="dark"; now_tr--; document.getElementById("the_table").rows(now_tr).className="light"; } อื่น { document.body.style.overflowY = ""; can_scroll = เท็จ; } } if(event.keyCode==40) { if(now_tr!=(document.getElementById("the_table").rows.length-1)) { document.body.style.overflowY = "ซ่อน" document.getElementById( "the_table").rows(now_tr).className="dark"; ตอนนี้_tr++; document.getElementById("the_table").rows(now_tr).className="light"; } อื่น { document.body.style.overflowY = ""; can_scroll = เท็จ; } } 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>