2010-05-16 73 views

回答

0

這裏是一些示例代碼來做它在Javascript中。

function AlertOnKeyPress(e) { 
    var code; 
    if (!e) var e = window.event; 
    if (e.keyCode) code = e.keyCode; 
    else if (e.which) code = e.which; 
    var character = String.fromCharCode(code); 
    alert('Character was ' + character); 
} 
相關問題