[Javascript] Keypress and a name jump

Nick Fitzsimons nick at nickfitz.co.uk
Fri Jan 5 11:29:05 CST 2007


On 5 Jan 2007, at 17:03:59, Guillaume wrote:

>
> I'm using the function below to detect a keypress and I'd like also  
> when this key is pressed to jump to a <a name="thereUgo"> in my  
> document...
> Just as you would jump to a content <a name="thereUgo"> when you  
> click on a <a href="#thereUgo>... Except that I try to do this with  
> the keypress script below...

Replace:
>    if(key == 't'){ myFunction(); }
>

with

    if (key == "t") { self.location.href = "#thereUgo"; }

and it should work. (I haven't tested it, though.)

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/






More information about the Javascript mailing list