473,772 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9255
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(d ocument.links['test'].href);">
<a href="test.html " id="test">A Link</a>

The above works in Mozilla 1.5a, not IE

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

The above works in IE, not Mozilla 1.5a

<body onload="alert(d ocument.getElem entById('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*****@agrico reunited.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*****@agrico reunited.com> schrieb im Newsbeitrag
news:3F******** *******@agricor eunited.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(d ocument.links['test'].href);">
<a href="test.html " id="test">A Link</a>

The above works in Mozilla 1.5a, not IE

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

The above works in IE, not Mozilla 1.5a

<body onload="alert(d ocument.getElem entById('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*****@agrico reunited.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
3798
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 = eval(myElement.children.innerText); 6 /*
22
2544
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
4432
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? Thanks in advance for any helpful suggestions
4
4894
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 class="formtext"> <input type="radio" class="inputRadio" id="dbStatus" name="dbStatus" value="1" onclick="changeDbStatus(1)" <%if dbStatus=1 then%checked
6
1687
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why doesn't the global variable "divId" always refer to the element with id="divId"? ----------------------------------------------------------------------- Microsoft introduced a shortcut that can be used to reference elements which include an ID attribute where the ID becomes a global variable. Some browsers reproduce this behaviours but some, most...
2
1602
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
3576
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 problem: I have a large column div with text and links in it, and then some "special area links" that should be orange and different from the standard text links. But even though I have declared all colourchanges for my "special area" a tags, they just...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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
10103
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
10038
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
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
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
5354
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...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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

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.