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