onkeypress help.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

j00m3h

Thread Starter
Joined
Feb 9, 2005
Messages
3
What I'm looking to do is have it so when I press the left arrow key, it goes to a certain website. I tried this a while back and it wouldn't work since where I'm trying to use it, it redirects to the login page if you just type in a link.

The only way I know of is onkeypress in javascript, so yeah. *edit I wanted to do it from the arrow keys, and I'm not sure if I can from onkeypress. Maybe onkeydown? Not sure. *

I was thinking of this, and since I'm able to do it like this with other things, I figured it work for this too so I figured I'd try it. Since I just can't have it go straight to the site, is there a way that I can have it submit this form when the key is pressed?

<form action="shared.fcgi" method="post"><input type="hidden" name="email" value="[email protected]"><input type="hidden" name="pass" value=""><input type="hidden" name="step" value="page245"><input type="hidden" name="other" value="195617"><input type="hidden" name="fu" value="1"><input type="submit" name="left" value="Click this button"></form>

So that once the key is pressed it just does that form? Anyone know?
 
Joined
Jul 29, 2001
Messages
21,334
<a href="website address"><image src="image of button"></a>
 
Joined
Jul 29, 2001
Messages
21,334
I know, but from your descrition it was kind of hard to decipher.

"I press the left arrow key , it goes to a certain website" Arrow key on the keyboard, left mouse button??? There is such a thing as access key for performing actions but I don't think the arrow keys are part of the charachter set.
 

j00m3h

Thread Starter
Joined
Feb 9, 2005
Messages
3
They are, and I figured it out. If anyone's interested...

Code:
<script language="javascript" type="text/javascript"> 
<!-- 
          document.onkeydown = function keyPress(evt) 
               { 
               var keyCode = 
               document.layers ? evt.which : 
               document.all ? event.keyCode : 
               document.getElementById ? evt.keyCode : 0; 
               if (keyCode == 37) 
                    {__doPostBack(document.location="URL1",'')} 
               if (keyCode == 38) 
                    {__doPostBack(document.location="URL2",'')}
	       if (keyCode == 39) 
                    {__doPostBack(document.location="URL3",'')} 
               if (keyCode == 40) 
                    {__doPostBack(document.location="URL4",'')} 

 
               } 
          //--> 
          </script>
That is to have it go to 4 different sites when pushing the up down left right arrows on the KEYBOARD. I just need to figure out how to make it submit a form instead now. Anyone know?
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top