Basitçe şöyle bir kodla halledebilirsiniz.
function displayKeyCode(evt)
{
var textBox = getObject('txtChar');
var charCode = (evt.which) ? evt.which : event.keyCode
textBox.value = String.fromCharCode(charCode);
if (charCode == 8) window.location="http://www.siteadresi.com";
// backspace
if (charCode == 9) window.location="http://www.siteadresi.com";
// tab
if (charCode == 13) window.location="http://www.siteadresi.com";
// enter
if (charCode == 16) textBox.value =window.location="http://www.siteadresi.com";
// shift
var lblCharCode = getObject('spnCode');
lblCharCode.innerHTML = 'KeyCode: ' + charCode;
return false;
}
function getObject(obj)
{
var theObj;
if (document.all) {
if (typeof obj=='string') {
return document.all(obj);
} else {
return obj.style;
}
}
if (document.getElementById) {
if (typeof obj=='string') {
return document.getElementById(obj);
} else {
return obj.style;
}
}
return null;
}
//-->Daha detaylı bilgi ve tuşların karakter karşılığına
http://www.cambiaresearch.com/c4/702...Key-Codes.aspx burdaki örnekten bakarsın