ภาษาไทย
<script language="javascript"> var startMoving=false; ฟังก์ชั่น MouseDownToMove (obj) { obj.style.zIndex=1; obj.mouseDownY=event.clientY; obj.mouseDownX=event.clientX; startMoving=จริง; obj.setCapture(); } // javascript เพิ่มเติมจากฟังก์ชัน http://downcodes.com MouseMoveToMove(obj){ if(!beginMoving) ส่งคืน false; obj.style.top = (event.clientY-obj.mouseDownY); obj.style.left = (event.clientX-obj.mouseDownX); } ฟังก์ชั่น MouseUpToMove(obj){ if(!beginMoving) ส่งคืนค่า false; obj.releaseCapture(); obj.style.top=0; obj.style.left=0; obj.style.zIndex=0; startMoving=เท็จ; var tempTop=event.clientY-obj.mouseDownY; var tempRowIndex=(tempTop-tempTop%25)/25; ถ้า(tempRowIndex+obj.rowIndex <0 )tempRowIndex=-1; อย่างอื่น tempRowIndex=tempRowIndex+obj.rowIndex; ถ้า (tempRowIndex >= obj.parentElement.rows.length-1) tempRowIndex = obj.parentElement.rows.length-1; obj.parentElement.moveRow(obj.rowIndex,tempRowIndex); } </script> 用鼠标移动TR<br> <TABLE WIDTH="300" BORDER="1" > <TR bgcolor=#ffffff style='height:25;position:relative;' onmousedown='MouseDownToMove(นี้)' onmousemove='MouseMoveToMove(นี้)' onmouseup='MouseUpToMove(นี้);'><TD bgcolor=blue>0</TD><TD>0</TD><TD>0< /TD></TR> <TR bgcolor=#ffffff style='height:25;position:relative;' onmousedown='MouseDownToMove(นี้)' onmousemove='MouseMoveToMove(นี้)' onmouseup='MouseUpToMove(นี้);'><TD bgcolor=black>1</TD><TD>1</TD><TD>1< /TD></TR> <TR bgcolor=#ffffff style='height:25;position:relative;' onmousedown='MouseDownToMove(นี้)' onmousemove='MouseMoveToMove(นี้)' onmouseup='MouseUpToMove(นี้);'><TD bgcolor=red>2</TD><TD>2</TD><TD>2< /TD></TR> <TR bgcolor=#ffffff style='height:25;position:relative;' onmousedown='MouseDownToMove(นี้)' onmousemove='MouseMoveToMove(นี้)' onmouseup='MouseUpToMove(นี้);'><TD>3</TD><TD>3</TD><TD>3</TD> </TR> <TR bgcolor=#ffffff style='height:25;position:relative;' onmousedown='MouseDownToMove(นี้)' onmousemove='MouseMoveToMove(นี้)' onmouseup='MouseUpToMove(นี้);'><TD>4</TD><TD>4</TD><TD>4</TD> </TR> <TR bgcolor=#ffffff style='height:25;position:relative;' onmousedown='MouseDownToMove(นี้)' onmousemove='MouseMoveToMove(นี้)' onmouseup='MouseUpToMove(นี้);'><TD>5</TD><TD>5</TD><TD>5</TD> </TR> <TR bgcolor=#ffffff style='height:25;position:relative;' onmousedown='MouseDownToMove(นี้)' onmousemove='MouseMoveToMove(นี้)' onmouseup='MouseUpToMove(นี้);'><TD>6</TD><TD>6</TD><TD>6</TD> </TR> <TR bgcolor=#ffffff style='height:25;position:relative;' onmousedown='MouseDownToMove(นี้)' onmousemove='MouseMoveToMove(นี้)' onmouseup='MouseUpToMove(นี้);'><TD>7</TD><TD>7</TD><TD>7</TD> </TR> </สคริปต์> </ตาราง>