Jump to content

Javascript Links [SOLVED]


LucasMars123

Recommended Posts

Can someone please give me some example code so I can link a webpage to another using javascript? This is my code at the moment:- document.onkeydown = function(e) { e = e || window.event; // because of Internet Explorer k = e.which || e.charCode || e.keyCode; // because of browser differences... if (k == 49 && !e.altKey && !e.ctrlKey && !e.shiftKey) { string.link(link.html) } else { return true; } return false; } This won't link me to the other link when "1" on the keyboard is pressed... Please Help!

Edited by LucasMars123
Link to comment
Share on other sites

Also, are you checking the error console for errors? I would imagine from that snippet there would be. im not sure where you got string.link from? to redirect to another page, you can change the window.location property,

window.location = 'http://www.google.com';

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...