hello, I just want to be able to use a keypress to do the same as clicking a
link. such as [right arrow] will 'click' a certain link, while [left arrow]
will 'click' a different link.
thanks for your time,
juglesh B>{)} 6 4917
juglesh wrote: hello, I just want to be able to use a keypress to do the same as clicking a link. such as [right arrow] will 'click' a certain link, while [left arrow] will 'click' a different link.
thanks for your time, juglesh B>{)}
<script type="text/javascript">
function keyHandler( e )
{
if( !e )
{
e = window.event;
}
arrowUp = 38;
arrowDown = 40;
arrowLeft = 37;
arrowRight = 39;
switch( e.keyCode )
{
case arrowUp:
//Do something
break;
case arrowDown:
//Do something
break;
case arrowLeft:
//Do something
break;
case arrowRight:
//Do something
break;
}
}
document.onkeydown = keyHandler;
</script>
"Nik Coughin" <nr***********@woosh.co.nz> wrote in message
news:bf*********************@news.xtra.co.nz... juglesh wrote: hello, I just want to be able to use a keypress to do the same as clicking a link. such as [right arrow] will 'click' a certain link, while [left arrow] will 'click' a different link.
thanks for your time, juglesh B>{)}
<script type="text/javascript"> function keyHandler( e ) {
if( !e ) { e = window.event; }
arrowUp = 38; arrowDown = 40; arrowLeft = 37; arrowRight = 39;
switch( e.keyCode ) { case arrowUp: //Do something break; case arrowDown: //Do something break; case arrowLeft: //Do something break; case arrowRight: //Do something break; } }
document.onkeydown = keyHandler; </script>
ok, thanks, that works. the reason I was thinking it should click a certain
link on the page is cuz php is writing out the link for me, and will be
different each page. is there any way for javascript to 'click ' a link?
I'm just having php write out this javascript you gave me, so my problem is
solved without the < javascript 'click ' a link> question.
j
juglesh wrote: "Nik Coughin" <nr***********@woosh.co.nz> wrote in message news:bf*********************@news.xtra.co.nz... juglesh wrote: hello, I just want to be able to use a keypress to do the same as clicking a link. such as [right arrow] will 'click' a certain link, while [left arrow] will 'click' a different link.
thanks for your time, juglesh B>{)}
<script type="text/javascript"> function keyHandler( e ) {
if( !e ) { e = window.event; }
arrowUp = 38; arrowDown = 40; arrowLeft = 37; arrowRight = 39;
switch( e.keyCode ) { case arrowUp: //Do something break; case arrowDown: //Do something break; case arrowLeft: //Do something break; case arrowRight: //Do something break; } }
document.onkeydown = keyHandler; </script>
ok, thanks, that works. the reason I was thinking it should click a certain link on the page is cuz php is writing out the link for me, and will be different each page. is there any way for javascript to 'click ' a link? I'm just having php write out this javascript you gave me, so my problem is solved without the < javascript 'click ' a link> question.
j
Easiest way to do it is probably change the document.location:
case arrowLeft:
document.location.href = "page1.html";
break;
case arrowRight:
document.location.href = "page3.html";
break;
Nik Coughin wrote: juglesh wrote: "Nik Coughin" <nr***********@woosh.co.nz> wrote in message news:bf*********************@news.xtra.co.nz... juglesh wrote: hello, I just want to be able to use a keypress to do the same as clicking a link. such as [right arrow] will 'click' a certain
link, while [left arrow] will 'click' a different link.
thanks for your time, juglesh B>{)}
<script type="text/javascript"> function keyHandler( e ) {
if( !e ) { e = window.event; }
arrowUp = 38; arrowDown = 40; arrowLeft = 37; arrowRight = 39;
switch( e.keyCode ) { case arrowUp: //Do something break; case arrowDown: //Do something break; case arrowLeft: //Do something break; case arrowRight: //Do something break; } }
document.onkeydown = keyHandler; </script>
ok, thanks, that works. the reason I was thinking it should click
a certain link on the page is cuz php is writing out the link for me, and will be different each page. is there any way for javascript
to 'click ' a link? I'm just having php write out this javascript you gave me, so my problem is solved without the < javascript 'click ' a link>
question. j
Easiest way to do it is probably change the document.location...
(snip)
Except that it's *window*.location. document.location is deprecated,
although many user agents seem to have mapped it to window.location (in
other words, it works) - but it's still incorrect. btw,
document.location is now document.URL. http://www.mozilla.org/docs/dom/domr...doc_ref39.html
"Nik Coughin" <nr***********@woosh.co.nz> wrote in message
news:E6*********************@news.xtra.co.nz... juglesh wrote: "Nik Coughin" <nr***********@woosh.co.nz> wrote in message news:bf*********************@news.xtra.co.nz... juglesh wrote: hello, I just want to be able to use a keypress to do the same as clicking a link. such as [right arrow] will 'click' a certain link, while [left arrow] will 'click' a different link.
thanks for your time, juglesh B>{)}
<script type="text/javascript"> function keyHandler( e ) {
if( !e ) { e = window.event; }
arrowUp = 38; arrowDown = 40; arrowLeft = 37; arrowRight = 39;
switch( e.keyCode ) { case arrowUp: //Do something break; case arrowDown: //Do something break; case arrowLeft: //Do something break; case arrowRight: //Do something break; } }
document.onkeydown = keyHandler; </script>
ok, thanks, that works. the reason I was thinking it should click a certain link on the page is cuz php is writing out the link for me, and will be different each page. is there any way for javascript to 'click ' a link? I'm just having php write out this javascript you gave me, so my problem is solved without the < javascript 'click ' a link> question.
j
Easiest way to do it is probably change the document.location:
case arrowLeft: document.location.href = "page1.html"; break; case arrowRight: document.location.href = "page3.html"; break;
yeah, that's what I did. uh, except I forgot the .href, seems to be
working, though...I used window.location actually. pros and cons?
juglesh wrote: "Nik Coughin" <nr***********@woosh.co.nz> wrote in message news:E6*********************@news.xtra.co.nz... juglesh wrote: "Nik Coughin" <nr***********@woosh.co.nz> wrote in message news:bf*********************@news.xtra.co.nz... juglesh wrote: > hello, I just want to be able to use a keypress to do the same
as> clicking a link. such as [right arrow] will 'click' a certain
link,> while [left arrow] will 'click' a different link. > > thanks for your time, > juglesh B>{)}
<script type="text/javascript"> function keyHandler( e ) {
if( !e ) { e = window.event; }
arrowUp = 38; arrowDown = 40; arrowLeft = 37; arrowRight = 39;
switch( e.keyCode ) { case arrowUp: //Do something break; case arrowDown: //Do something break; case arrowLeft: //Do something break; case arrowRight: //Do something break; } }
document.onkeydown = keyHandler; </script>
ok, thanks, that works. the reason I was thinking it should click
a certain link on the page is cuz php is writing out the link for
me, and will be different each page. is there any way for javascript
to 'click ' a link? I'm just having php write out this javascript you gave me, so my problem is solved without the < javascript 'click ' a link>
question. j
Easiest way to do it is probably change the document.location:
case arrowLeft: document.location.href = "page1.html"; break; case arrowRight: document.location.href = "page3.html"; break;
yeah, that's what I did. uh, except I forgot the .href, seems to be working, though...I used window.location actually. pros and cons?
According to David Flanagan (javascript : The Definitive Guide,
O'Reilly):
In addition to its properties, the Location object can be used as if it
were itself a primitive string value. If you read the value of a
Location object, you get the same string as you would if you read the
href property of the object (this is because the Location object has a
suitable toString() method). What is far more interesting, though, is
that you can assign a new URL string to the location property of a
window. Assigning a URL to the Location object like this has a very
important side effect: it causes the browser to load and display the
contents of the URL you assign (this side effect occurs because the
Location has a suitable assign() method).
While you might expect there to be a method you can call to make the
browser display a new web page, assigning a URL to the location
property of a window is the supported technique to accomplish this. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Fred Brown |
last post by:
Hi,
I want to cancel a certain key in JavaScript.
To do so, I catch the event in OnKeyPress and cancel the default:
<head>
....
function f(evt)
{
var evt = (evt) ? evt : ((window.event) ?...
|
by: Albert Wagner |
last post by:
I have included a file below that tests onKeyPress in Opera 7.11. I am
getting peculiar behavior. When the file is first loaded, pressing the
keypad + causes the textarea to get physically larger...
|
by: Kev |
last post by:
I need to make some specific alterations to some JavaScript in webpages in
order to comply with government guidelines on accessibility. Apparently,
whenever the OnClick event is used, it must be...
|
by: Hasan Ammar |
last post by:
Is it possible to set up hotkeys using onkeypress? I know it can be
done with the usual alphanumeric keys, but what about function keys?
or using ctrl/alt combinations? Does anybody have a...
|
by: LilAndy23 |
last post by:
How can I use the onKeyPress event handler in Firefox? onKeyPress
doesn't seem to fire in Firefox.
|
by: ~toki |
last post by:
How can i take the control of the key events in Class2 ?
This is the code snipped that i'd tried (after try some others):
public class Main : System.Windows.Forms.Form
{
protected virtual...
|
by: Simon Wigzell |
last post by:
I'm using a javascript function to interecept all key presses and check for
valid character and also check the length of the current string and if it is
greater than a sent value, set the focus to...
|
by: Simon Wigzell |
last post by:
I have a simple function whose purpose is to return false onkeypress and
then that character should not appear in the text field.
On any browser I have tried on a PC the return false means that the...
|
by: vega80 |
last post by:
Hi.
I have a problem with assigning an onkeypress-function to dynamically
created input-boxes.I want to put the content of an input-field into a
tag-list when the user hits enter. This works...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |