473,387 Members | 1,569 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,387 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 9237
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.