473,668 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set focus on hypertext link?

I am trying to create a hypertext link (text within an anchor) so that
if the onlly thing the user does is to press Enter, the link will take
affect and navigate properly. The link is not the first "object" on
the page. Tabbing to the hypertext certainly works.

Any ideas?

Rich Blackburn
Feb 10 '06 #1
5 16559
Rich Blackburn wrote:
I am trying to create a hypertext link (text within an anchor) so that
if the onlly thing the user does is to press Enter, the link will take
affect and navigate properly. The link is not the first "object" on
the page. Tabbing to the hypertext certainly works.

Any ideas?


No, you have been too unspecific. Please elaborate.
PointedEars
Feb 10 '06 #2
My apologies. Here is the Reader's Digest version similar to the code
I would LIKE to invoke. I know it is incorrect, but I am looking for
an alternative method to set the focus to the link so if the user
simply presses Enter, the link would be invoked.

<html>
<head>
<title>Menu</title>
</head>
<body onLoad=document .frm.LINK.focus ()>
<Form name="frm">
<input type="text" size="6" maxlength="6" name="USER" value="123456">
<A name="LINK" HREF="javascrip t:sbmt('Mail')" ">Email</A>
<form>
</body>
</html>
On Fri, 10 Feb 2006 21:43:34 +0100, Thomas 'PointedEars' Lahn
<Po*********@we b.de> wrote:
Rich Blackburn wrote:
I am trying to create a hypertext link (text within an anchor) so that
if the onlly thing the user does is to press Enter, the link will take
affect and navigate properly. The link is not the first "object" on
the page. Tabbing to the hypertext certainly works.

Any ideas?


No, you have been too unspecific. Please elaborate.
PointedEars


Feb 10 '06 #3
Rich Blackburn wrote:
[...] I am looking for an alternative method to set the focus to the
link so if the user simply presses Enter, the link would be invoked.
[...]
<html>
The DOCTYPE declaration is missing before.
<head>
<title>Menu</title>
Be sure to serve the Content-Type header with the `charset' label
if you omit the charset declaration per `meta' element --

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

-- here.
</head>
<body onLoad=document .frm.LINK.focus ()> ^^^^^^^^^^^^^^^ ^^^^^^^^^^
Attribute values containing the `(' or `)' character must be delimited
with single or double quotes. Because of the several exceptions (see
the HTML 4.01 Specification), attribute values should be quoted always.

Hyperlinks are not form controls. Even if they were, it should be the
almost standards-compliant

document.forms['frm'].elements['LINK'].focus().

Correct is here:

<body onload="documen t.links['LINK'].focus();">

However, I question you forcing the focus when the document is loaded,
patronizing your users.
<Form name="frm">
The `action' attribute value is missing.
<input type="text" size="6" maxlength="6" name="USER" value="123456">
`type="text"' is the default and can be safely omitted here.
<A name="LINK" HREF="javascrip t:sbmt('Mail')" ">Email</A>
Should be at least

<head>
...
<meta http-equiv="Content-Script-Type" content="text/javascript">
...
</head>

<body>
...
<a href="noscript. html" name="LINK"
onclick="sbmt(' Mail'); return false;"E-mail</a> ...
</body>

See <URL:http://jibbering.com/faq/#FAQ4_24>
[...]
First write Valid HTML, then use client-side scripting.

<URL:http://validator.w3.or g/>
[top post]


Don't. <URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1P ost>
HTH

PointedEars
Feb 10 '06 #4
Thomas, that certainly was a most appreciated, thorough, educational
response. I am grateful. I used the validator you so kindly noted
and ended up with the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Menu</title>
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
</head>
<body onload="documen t.links['LINK'].focus();" >
<form name="frm" action="do_noth ing" />
<p><input type="text" size="6" maxlength="6" name="USER"
value="123456"/></p>
<p><a href="noscript. html" name="LINK" onclick="sbmt(' Mail'); return
false;" >E-mail</a></p>
</form>
</body>
</html>

However, I get an error:

Line: 7
Error: 'document.links .LINK' is null or not an object.

Am I out of airspeed, altitude, and ideas?

Thanks,
Rich Blackburn



On Sat, 11 Feb 2006 00:42:32 +0100, Thomas 'PointedEars' Lahn
<Po*********@we b.de> wrote:
Rich Blackburn wrote:
[...] I am looking for an alternative method to set the focus to the
link so if the user simply presses Enter, the link would be invoked.
[...]
<html>


The DOCTYPE declaration is missing before.
<head>
<title>Menu</title>


Be sure to serve the Content-Type header with the `charset' label
if you omit the charset declaration per `meta' element --

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

-- here.
</head>
<body onLoad=document .frm.LINK.focus ()>

^^^^^^^^^^^^^^^ ^^^^^^^^^^
Attribute values containing the `(' or `)' character must be delimited
with single or double quotes. Because of the several exceptions (see
the HTML 4.01 Specification), attribute values should be quoted always.

Hyperlinks are not form controls. Even if they were, it should be the
almost standards-compliant

document.forms['frm'].elements['LINK'].focus().

Correct is here:

<body onload="documen t.links['LINK'].focus();">

However, I question you forcing the focus when the document is loaded,
patronizing your users.
<Form name="frm">


The `action' attribute value is missing.
<input type="text" size="6" maxlength="6" name="USER" value="123456">


`type="text" ' is the default and can be safely omitted here.
<A name="LINK" HREF="javascrip t:sbmt('Mail')" ">Email</A>


Should be at least

<head>
...
<meta http-equiv="Content-Script-Type" content="text/javascript">
...
</head>

<body>
...
<a href="noscript. html" name="LINK"
onclick="sbmt(' Mail'); return false;"
>E-mail</a>

...
</body>

See <URL:http://jibbering.com/faq/#FAQ4_24>
[...]


First write Valid HTML, then use client-side scripting.

<URL:http://validator.w3.or g/>
[top post]


Don't. <URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1P ost>
HTH

PointedEars


Feb 11 '06 #5
Rich Blackburn wrote:
Thomas, that certainly was a most appreciated, thorough, educational
response. I am grateful.
You are welcome. However I would have appreciated it more if you had
followed _all_ recommendations . See the bottom of this posting for
details.
[...]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Menu</title>
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
</head>
<body onload="documen t.links['LINK'].focus();" >
<form name="frm" action="do_noth ing" /> ^^^^[1] ^^[2]

[1] In XHTML 1.0 _Strict_, the `form' element has no `name' attribute.
[2] The element ends here empty.
<p><input type="text" size="6" maxlength="6" name="USER"
value="123456"/></p>
<p><a href="noscript. html" name="LINK" onclick="sbmt(' Mail'); return
false;" >E-mail</a></p>
</form>
</body>
</html>
If I feed this to Firefox's XML parser, I get

| XML Parsing Error: mismatched tag. Expected: </body>.
| [...]
| Line Number 14, Column 3:
|
| </form>
| --^

because of the above.
However, I get an error:
In which browser on which operating system and platform
(navigator.user Agent)? With which media type is this
document resource served?
Line: 7
Error: 'document.links .LINK' is null or not an object.

Am I out of airspeed, altitude, and ideas?
Your markup is still not Valid, and the W3C Markup Validator tells you.
Furthermore, I recommend that you do not use XHTML 1.0 Strict here; HTML
4.01 Strict suffices. And you should not use the p(aragraph) element
where there is no text paragraph; use the div(ision) element in that
case instead.
[top post again]


You have been asked already to quote properly. Your repeated disregarding
of recommended posting guidelines is a sign to your readers that you do not
care about them.
PointedEars
Feb 11 '06 #6

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

Similar topics

2
2151
by: Acorn Tutors | last post by:
Hi folks, what I would like to do is to store the name of a link, such as link1.php in a field, lets say the field is called Favoritelinks, in a database as a bit of text. Then, on a logged in page, pull the value from the field and put in right in the <a href><a> tag so that the link now points to a file, and is dynamic. And, depending on the username and password, the value taken from Favoritelinks changes. What Im after is to...
9
2072
by: Yann.K | last post by:
Hello. I would like to do a hypertext link on a GUI, which launch a per default mail user agent (with the "to" header documented). To launch an url in a web browser i use webbrowser.open(url). Do exist an equivalent command to run the per default MUA (like ie webbrowser.mail_open(toto@example.com)? Thank's for your help.
1
4412
by: krishna | last post by:
Hi, I am trying to set the focus to hyper link / image in a form. but the the image is not getting the focus. Any ideas. thanks, Krishna
4
4500
by: Stephen Poley | last post by:
The issue of the focus pseudo-class came up a few weeks ago, and I finally got around to trying it out (better late than never ...) The recommended order given for the pseudo-classes is link, visited, focus, hover, active. However: - Mozilla doesn't seem to do anything with the active rule; - IE gets things wrong as usual: it uses the active rule for focus; it ignores the focus rule; - Opera ignores both focus and active rules and...
3
2619
by: Dai Ba Wong | last post by:
Hi: Currently I am having a problem with my webpage. My page consist of two frames, one consist of input text field and the other contains link for different pop-up windows. The problem follows: 1. At the beginning, focus is placed on an input text field of the first frame (so there's a blinking cursor on such field). 2. Then users click on a link of the second frame (thus focus is set
4
1398
by: John Doe | last post by:
Hi I want to convert a column to a link. All examples I have seen works with bound columns. I have the following grid: <asp:datagrid runat="server" id="__theDetailsGrid" cellpadding="2" cellspacing="0" OnItemDataBound="Details_Item_Bound"> </asp:datagrid> It is bound during runtime to a DataTable that is bound to a SqlDataAdapter. The Details_Item_Bound function changes
11
7334
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz 1.7.12 (linux kubuntu). It does work with konqueror. It seems to work with firefox on windows but not with IE (not completly sure though).
12
3787
by: ppcguy | last post by:
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.
0
1060
by: mohanht | last post by:
Hi All, I need to get the actual URN from the hypertext link from microsoft application like , outlook, word, IE etc, I need to get the URN when I point to the hyperlink.Copy that URN before clicking mouse on that. I'm stuck at gettiing the URN from hyperlink For copying part I can use windows hooks. Kindly help me to acheve this. Thanks, Mohan Tarole
0
8890
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8575
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7398
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2784
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.