473,396 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

activating a link

i've got a link that i give focus to via accesskey.

<a href="blah" accesskey=p>

in IE, that just gives it focus, but does not activate it.

how do i activate the link.

thx.
Jun 3 '06 #1
12 3753
ppcguy wrote:
i've got a link that i give focus to via accesskey.

<a href="blah" accesskey=p>

in IE, that just gives it focus, but does not activate it.
how do i activate the link.


The solution below is somewhat hokey, but it works in both Firefox and
IE 6. FF accepts an access key directly on the link (that accesskey=h
is for testing purposes). FF also lets you do
style="visibility:hidden" in the button element instead of
style="width:0px". I expect use of this method is an oversight on the
part of IE and wouldn't rely on it too heavily.

<form action='http://google.com' method=get>
<button type=submit style="width:0px" accesskey=g></button>
<a href="http://google.com" accesskey=h><u>G</u>oogle</a>
</form>

Csaba Gabor from Vienna

Jun 3 '06 #2
VK

ppcguy wrote:
i've got a link that i give focus to via accesskey.

<a href="blah" accesskey=p>

in IE, that just gives it focus, but does not activate it.

how do i activate the link.


<a href="http://www.google.com"
accesskey="t"
onfocus="location.href=this.href">Test</a>

That covers both.

Jun 3 '06 #3
VK wrote:
ppcguy wrote:
i've got a link that i give focus to via accesskey.

<a href="blah" accesskey=p>

in IE, that just gives it focus, but does not activate it.

how do i activate the link.


<a href="http://www.google.com"
accesskey="t"
onfocus="location.href=this.href">Test</a>

That covers both.


Ahem. Let's hope the users are not fans of the tab key. If they are,
they are in for a bit of a surprise. Not to mention clicking on the
link and moving the mouse away before releasing the button.

Csaba

Jun 3 '06 #4
VK
Csaba Gabor wrote:
VK wrote:
<a href="http://www.google.com"
accesskey="t"
onfocus="location.href=this.href">Test</a>

That covers both.
Ahem. Let's hope the users are not fans of the tab key. If they are,
they are in for a bit of a surprise.


Links are included into taborder by default, so navigation by tab
doesn't affect the above method. No surprise.
Not to mention clicking on the
link and moving the mouse away before releasing the button.


"Click" is defined as the sequence of "mousedown"-"mouseup" events on
the same point. So the event above is not clicking and the navigation
by link is not presumed - moreover must be prevented.

Jun 4 '06 #5
VK wrote:
Csaba Gabor wrote:
VK wrote:
<a href="http://www.google.com"
accesskey="t"
onfocus="location.href=this.href">Test</a>

That covers both. Ahem. Let's hope the users are not fans of the tab key. If they are,
they are in for a bit of a surprise.


Links are included into taborder by default,


In some browsers, not others. In some it is a preference setting.

Your method also has the drawback that, having navigated to the new URL,
if the 'back' button is used, the link is still in focus so you go
straight back to the new URL.

Very user-unfriendly.

... so navigation by tab doesn't affect the above method. No surprise.


Big surprise really. Suppose you are tabbing to some other link and on
the way put focus on an 'auto navigate' link - use the back button or
key combo to go back - WTF? You're stuck at the new URL.

Not to mention clicking on the
link and moving the mouse away before releasing the button.


"Click" is defined as the sequence of "mousedown"-"mouseup" events on
the same point. So the event above is not clicking and the navigation
by link is not presumed - moreover must be prevented.


You're right, it's not a click, it's a drag. You completely missed the
point though.

Your solution isn't based on a click, it's based on focus. It will
still navigate to the new URL even though it did not receive a click
event because the link keeps focus.

The whole purpose of dragging a link would be to drop it elsewhere (new
tab, page whatever) and leave the current page at the current URL. But
your method leaves both windows at the new URL.

Really, really user-unfriendly.
--
Rob
Jun 4 '06 #6
VK said the following on 6/4/2006 1:38 AM:
Csaba Gabor wrote:
VK wrote:
<a href="http://www.google.com"
accesskey="t"
onfocus="location.href=this.href">Test</a>

That covers both.

Ahem. Let's hope the users are not fans of the tab key. If they are,
they are in for a bit of a surprise.


Links are included into taborder by default, so navigation by tab
doesn't affect the above method. No surprise.


What is "No surprise" is your lack of the first clue about what the
problem would be.

Hint: Tabbing through the links to get to the next one puts focus on the
link.

I doubt you get the hint and understand it's ramifications so read Rob's
response. I don't care to try to explain common sense to you today.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 4 '06 #7
ppcguy wrote:
i've got a link that i give focus to via accesskey.

<a href="blah" accesskey=p>

in IE, that just gives it focus, but does not activate it.

how do i activate the link.

thx.

May be too late, but it sounds like your question doesnt need a js
solution. In IE hitting ALT + accesskey value will only give focus; you
then have to hit enter to activate it. So, to answer your question
literally, you would do ALT+p+ENTER.

Jun 6 '06 #8
er**********@gmail.com said the following on 6/6/2006 5:47 PM:
ppcguy wrote:
i've got a link that i give focus to via accesskey.

<a href="blah" accesskey=p>

in IE, that just gives it focus, but does not activate it.

how do i activate the link.

thx.

May be too late, but it sounds like your question doesnt need a js
solution. In IE hitting ALT + accesskey value will only give focus; you
then have to hit enter to activate it. So, to answer your question
literally, you would do ALT+p+ENTER.


Or ALT+p+SPACE

Try it :)
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 6 '06 #9
VK
Randy Webb wrote:
VK said the following on 6/4/2006 1:38 AM:
Links are included into taborder by default, so navigation by tab
doesn't affect the above method. No surprise.


What is "No surprise" is your lack of the first clue about what the
problem would be.

Hint: Tabbing through the links to get to the next one puts focus on the
link.


i) nothing is lost for the US soccer team yet - keep watching.

ii) German beer is the best - confirmed so many times, yet again.

iii) Euro Summer weather is much better as I could expect.

iv) The OP task was to navigate to a link on focus - this IMHO clearly
eliminate the option to navigate across the links on the same page
using TAB - really either you shift focus from link to link on TAB or
you navigate away on focus - but you cannot do the both on the same
event (focus). However user friendly it is - it is for OP's
considerations.

Jun 16 '06 #10
Try this:
<a href="blah" id="link1">Link 1 Blah!!!!</a>
<script type="text/javascript">
<!--
window.onkeydown = function(e) {
if (e.altKey && String.fromCharCode(e.keyCode) == 'P') {
document.getElementById('link1').focus();
location.href = document.getElementById('link1').href;
}
}
// -->
</script>

Don't sure it will work, but works in Firefox.

Jun 16 '06 #11
the DtTvB \/\/|20+3:
window.onkeydown = function(e) {


Umm sorry, document.onkeydown is correct.

Jun 16 '06 #12
VK said the following on 6/16/2006 3:23 AM:
Randy Webb wrote:
VK said the following on 6/4/2006 1:38 AM:
Links are included into taborder by default, so navigation by tab
doesn't affect the above method. No surprise. What is "No surprise" is your lack of the first clue about what the
problem would be.

Hint: Tabbing through the links to get to the next one puts focus on the
link.


i) nothing is lost for the US soccer team yet - keep watching.


For whatever that means to you, ok.
ii) German beer is the best - confirmed so many times, yet again.
I don't drink beer so I don't care.
iii) Euro Summer weather is much better as I could expect.
Typical off-topic ramblings today?
iv) The OP task was to navigate to a link on focus - this IMHO clearly
eliminate the option to navigate across the links on the same page
using TAB - really either you shift focus from link to link on TAB or
you navigate away on focus - but you cannot do the both on the same
event (focus). However user friendly it is - it is for OP's
considerations.


You finally got it. And navigating away on focus is a stupid idea.

But alas, it is a typical VK repsonse......
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 17 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bill | last post by:
Is it possible to somehow activate a page containing a php script by sending an email to a mailbox on the server? I have a script that sends out notification emails to an individual. He wants to...
3
by: Ruskin Hardie | last post by:
Ok, I am still playing with ASP and was wondering how to do this (it seemed simple). What I want is to have a hyperlink that when it's clicked on, will run a sub routine, instead of opening a web...
1
by: Jeppe 1971 | last post by:
Hi Does anyone know of a way to load a HTML-page and examine the document without activating the code? I am trying to create a search-function in javascript. The idea is that the function...
6
by: SF RVN | last post by:
Hmmmm.. a wee bit of a problem: Background default.htm has a left-aligned table serving as a 'navigation menu' and a right-aligned iFrame (named 'viewframe') serving as the 'target' for...
12
by: magmike | last post by:
When users of my site submit articles to our database (http://www.netterweb.com/articles/) they almost always have http:// addresses within the text. They are pasting that text into a box which...
3
by: Spartanicus | last post by:
I have a list of links using the following construct: <a href='#artane' onclick='pos(1107,281)'>Artane</a> The links offer additional functionality through JS. There are no actual fragment IDs...
10
by: Carlos Araya | last post by:
I have the following link on a web page <p class="menuitem"><a href="#" onclick="loadFragment('http://rivendellweb.net/fortress/home', 'index')" title="The Fortress Home">The Fortress...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.