<script type="text/javascript"></script> QWERTYUIOPASDFGHJKLZXCVBNM 脚本如下: <html> <head> <SCRIPT LANGUAGE="JavaScript"> <!-- var row = 1 ; var col = 0 ; var keys = null ; function keyDown(event){ var oldCell = "" + row + col ; var key = event.keyCode; if(key == 37) { //left if(row == 1) { if(col > 0) col-- ; else col = 9 ; } else if(row == 2) { if(col > 0) col-- ; else col = 8 ; } else if(row == 3) { if(col > 0) col-- ; else col = 6 ; } } else if(key == 39) { //right if(row == 1) { if(col < 9) col++ ; else col = 0 ; } else if(row == 2) { if(col < 8) col ++ ; else col = 0 ; } else if(row == 3) { if(col < 6) col ++ ; else col = 0 ; } } else if(key == 38) { //up if(row == 3) { row = 2 ; } else if(row == 2) { row = 1 ; } else { if(col > 6) col = 6 ; row = 3 ; } } else if(key == 40) { //down if(row == 1) { row = 2 ; if(col > 8) col = 8 ; } else if(row == 2) { row = 3 ; if(col > 6) col = 6 ; } else { row = 1 ; } } else if(key == 32) { //enter input_char(row,col); } else if(key == 8) { //backspace del_char(); } else if(key == 27) { reset(); } else if(key == 13) { col = 0 ; } else if(key == 46) { if(row ==1 ) col = 9 ; else if(row == 2) col = 8 ; else col = 6 ; } var cell = "" + row + col ; if(oldCell != cell) focus_cell(oldCell,cell); } document.onkeydown = keyDown; function focus_cell(oldCell,cell) { if(oldCell != null) { document.getElementById(oldCell).style.backgroundColor = "#FFFFFF"; document.getElementById(oldCell).style.color = "#000000"; } document.getElementById(cell).style.backgroundColor = "#FF0000"; document.getElementById(cell).style.color = "#FFFFFF"; } function get_char(row,col) { var cell = "" + row + col ; return keys[cell]; } function input_char(row,col){ var c = get_char(row,col); var txt = document.getElementById("txt").value ; txt = txt + c ; document.getElementById("txt").value = txt ; } function del_char() { var txt = document.getElementById("txt").value ; if(txt.length > 0) { txt = txt.substring(0,txt.length-1); document.getElementById("txt").value = txt ; } } function reset() { document.getElementById("txt").value = "" ; var cell = "" + row + col ; focus_cell(cell,"10"); row = 1 ; col = 0 ; } function init() { document.getElementById("txt").value = "" ; focus_cell(null,"10"); keys = new Array(); keys["10"] = "q" ; keys["11"] = "w" ; keys["12"] = "e" ; keys["13"] = "r" ; keys["14"] = "t" ; keys["15"] = "y" ; keys["16"] = "u" ; keys["17"] = "i" ; keys["18"] = "o" ; keys["19"] = "p" ; keys["20"] = "a" ; keys["21"] = "s" ; keys["22"] = "d" ; keys["23"] = "f" ; keys["24"] = "g" ; keys["25"] = "h" ; keys["26"] = "j" ; keys["27"] = "k" ; keys["28"] = "l" ; keys["30"] = "z" ; keys["31"] = "x" ; keys["32"] = "c" ; keys["33"] = "v" ; keys["34"] = "b" ; keys["35"] = "n" ; keys["36"] = "m" ; } //--> </SCRIPT> </head> <body οnlοad="init();"> <input type="text" id="txt" value="" size="40"/> <TABLE width="300" border="0" cellspacing="3" style=" font-weight: bold;font-size:30px;border:1px #AAA solid;" mce_style=" font-weight: bold;font-size:30px;border:1px #AAA solid;"> <TR> <TD align="center" id="10">Q</TD> <TD align="center" id="11">W</TD> <TD align="center" id="12">E</TD> <TD align="center" id="13">R</TD> <TD align="center" id="14">T</TD> <TD align="center" id="15">Y</TD> <TD align="center" id="16">U</TD> <TD align="center" id="17">I</TD> <TD align="center" id="18">O</TD> <TD align="center" id="19">P</TD> </TR> <TR> <TD align="center" id="20">A</TD> <TD align="center" id="21">S</TD> <TD align="center" id="22">D</TD> <TD align="center" id="23">F</TD> <TD align="center" id="24">G</TD> <TD align="center" id="25">H</TD> <TD align="center" id="26">J</TD> <TD align="center" id="27">K</TD> <TD align="center" id="28">L</TD> </TR> <TR> <TD align="center" id="30">Z</TD> <TD align="center" id="31">X</TD> <TD align="center" id="32">C</TD> <TD align="center" id="33">V</TD> <TD align="center" id="34">B</TD> <TD align="center" id="35">N</TD> <TD align="center" id="36">M</TD> </TR> </TABLE> </body> </html>