Click to See Complete Forum and Search --> : what are the "letter codes" for this...


sciguyryan
08-20-2003, 12:17 PM
hi all,


i had this code given to me earlier in this forum:


<script>
<!--
function getKey() {
if (String.fromCharCode(event.keyCode)=="a"){
location="http://a1-javascripts.com"
}
}
document.onkeypress = getKey;
// -->
</script>

but, what are the codes for the buttons such as "tab" the "F" buttons and things like ! and other "upper" letters.



can anyone provide an answer?
thank you for your help.

pyro
08-20-2003, 12:26 PM
Take a look at http://www.infinitypages.com/research/keycode.htm

sciguyryan
08-20-2003, 12:40 PM
hi,



thank you pyro your a great help but, how do i incorperate that number into the script?

pyro
08-20-2003, 01:08 PM
This script should work better cross browser.

<script type="text/javascript">
function whichKey(e) {
if (window.event) {
code = event.keyCode
}
else {
code = e.which;
}
if (code == 65) { //Chage the code here. Currently set to the letter 'a'.
window.location.href = "http://www.webdevfaqs.com";
}
}
document.onkeydown = whichKey;
</script>

sciguyryan
08-20-2003, 03:49 PM
hi,


thank you for your help it's most apreciated.

ps noce site you directed m to i'm looking through it now to find some more useful info...:D :D :D

pyro
08-20-2003, 04:05 PM
You are very welcome. I'm assuming you found your way to http://www.infinitypages.com/research...basically it's just a listing of some of the projects I've worked up for people who might find it useful. Hope it helps you out.

sciguyryan
08-20-2003, 04:11 PM
hi,


this site is great!
i have found a few useful scripts and, i like the websites design-a-lot too.
great site pyro!:)

pyro
08-20-2003, 04:14 PM
Thank you very much.

You might also be interested in http://www.webdevfaqs.com which is a brand new site brought to you by some of the moderators of this forum. (Khalid Ali, DaveSW, and myself)

sciguyryan
08-21-2003, 04:37 AM
hi,


thanks for the tip i'll take a look!:)
[edit] thanks again! i've now got another site to add to my collection! i've found some usefull stuff there too:)

pyro
08-21-2003, 06:58 AM
Great, glad those sites are helping you out... :)