472,989 Members | 3,095 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

document.links["id"].href -> Browsersafe?

Does this work in most browsers, namely MSIE?

document.links["idOfTheElement"].href

or does it have to be

document.links[0].href

?

Thanks and cheers,
Konrad
Jul 20 '05 #1
2 9214
Konrad Mathieu wrote:
Does this work in most browsers, namely MSIE?

document.links["idOfTheElement"].href

or does it have to be

document.links[0].href

?

Thanks and cheers,
Konrad


Why not try it?

<body onload="alert(document.links['test'].href);">
<a href="test.html" id="test">A Link</a>

The above works in Mozilla 1.5a, not IE

<body onload="alert(document.links('test').href);">
<a href="test.html" id="test">A Link</a>

The above works in IE, not Mozilla 1.5a

<body onload="alert(document.getElementById('test').href );">
<a href="test.html" id="test">A Link</a>

The above works in IE 6SP1, Mozilla 1.5a and Opera 7.11. I didn't check
the first two test in Opera because each failed in at least one of the
two major browsers you probably want to support. Also, simply because I
provided specific browser versions does not mean it won't work in early
versions, it simply means those are the versions I tested the code with.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #2
"Konrad Mathieu" <no****@nospam.com> wrote in message news:<10****************@doris.uk.clara.net>...
thanks!

"Grant Wagner" <gw*****@agricoreunited.com> schrieb im Newsbeitrag
news:3F***************@agricoreunited.com...
Konrad Mathieu wrote:
Does this work in most browsers, namely MSIE?

document.links["idOfTheElement"].href

or does it have to be

document.links[0].href

?

Thanks and cheers,
Konrad

The links collection seems to support the item method in both IE 6 and Netscape 7:

<a href="a.htm" id='a1' name='anchor1'
onclick="alert(document.links.item('a1').name); return false;"
Anchor Name</a>


Not an expert. FWIW.


Why not try it?

<body onload="alert(document.links['test'].href);">
<a href="test.html" id="test">A Link</a>

The above works in Mozilla 1.5a, not IE

<body onload="alert(document.links('test').href);">
<a href="test.html" id="test">A Link</a>

The above works in IE, not Mozilla 1.5a

<body onload="alert(document.getElementById('test').href );">
<a href="test.html" id="test">A Link</a>

The above works in IE 6SP1, Mozilla 1.5a and Opera 7.11. I didn't check
the first two test in Opera because each failed in at least one of the
two major browsers you probably want to support. Also, simply because I
provided specific browser versions does not mean it won't work in early
versions, it simply means those are the versions I tested the code with.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*

http://devedge.netscape.com/library/...3/reference/fr
ames.html

* Internet Explorer DOM Reference available at:
*

http://msdn.microsoft.com/workshop/a...l_reference_en
try.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html

Jul 20 '05 #3

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

Similar topics

13
by: Julia Peterwitz | last post by:
I have a function that works with explorer but not with netscape. The problem is the function at line 5. 1 fSetSelectedDay(myElement){ 2 /* 3 ... 4 */ 5 var elementText =...
22
by: David. E. Goble | last post by:
Hi All; I have a few of these; sigsImages="sigs/finished1.jpg" sigsImages="sigs/foghorn.jpg" lower I have;
8
by: Just Me | last post by:
1)How can I find the folders like "My Recent Document", "Desktop", "My Pictures",... if I want to store a file there? 2) How can I find the icon for those files if I want to display it? ...
4
by: chaz | last post by:
here is the html : <br> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="<%=LABEL_WIDTH%>" class="formtext"><%= HTEXT("Connection type:")%></td> <td...
6
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why doesn't the global variable "divId" always refer to the element with id="divId"?...
2
by: ramapv | last post by:
how can i get a functionality of drag and drop of text from one frame to other frame or even on double click as that of selecting files in a nero burner before we burn a CD.
2
by: BadFeeling | last post by:
Hi all, I have started with css some months ago, and though I'm feeling more and more safe and comfortable, some parts of css still don't make perfect sense to me. Right now I have this...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.