Click to See Complete Forum and Search --> : linking to a site with a specific button click.


sciguyryan
08-16-2003, 06:59 AM
hi all,


how could i make it so that if a user on my site clicks say the letter "A" on their keyboard they will be take to a site E.g. http://a1-javascripts.com/.
could this be done?
if anyone could provide an answer or code i would be most great full.
thank you in advance.

Mr J
08-16-2003, 10:03 AM
Please try the following


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

Khalid Ali
08-16-2003, 10:48 AM
Or you can learn everything(almost) about keypressing events at this location(rather elaborate use of JavaScript).

http://www.webapplikations.com/pages/html_js/document/OpenPagesWithKeyPress.html

sciguyryan
08-16-2003, 11:16 AM
hi,


thank you bothe for your inputand thanks for the great advice.

ps.
i'll try that site it looks good!