Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Strange behaviour in Internet Explorer with document.links[i].href

Reply
Thread Tools

Strange behaviour in Internet Explorer with document.links[i].href

 
 
Heiko Pliefke
Guest
Posts: n/a
 
      02-11-2004
Hi NG!

I have to change dynamically all hyperlinks, when the html-page is
loaded at the client. This works fine, except in the following scenario:

When the innerText of an anchor contains an '@', the InternetExplorer
changes the innerText-Property to the HREF-Property. I have checked this
with MoZilla/FireBird and Opera and there is no problem!

To explain, what i mean, see following example:
function atTest(){
for(var i=0; i < document.links.length; ++i)
{
document.links[i].href = document.links[i].href;
}

}

Now you need some anchor tags - notice the '@' as inner Text:

<a href="http://www.somelink.org/">Text before @ and after</a><br>
<a href="http://www.somelink.org/">Text before @</a><br>
<a href="http://www.somelink.org/">@ before text</a><br>
<a href="http://www.somelink.org/">Text before at and after</a>


If you load the page, InternetExplorer will display the HREF-Property
instead of "Text before @ and after" - all other elements are shown
correctly! It doesn't bother other browsers: Opera/MoZilla shows _even_
the first element with innerText.

My system: Windows XP SP1, InternetExplorer SP1, Firebird0.7, Opera 7.23

Has anybody out there an idea, why IE behaves like this? And how I can
work around this?

Any help/feedback is greatly appreciated! Best regards

--
Heiko Pliefke

 
Reply With Quote
 
 
 
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      02-11-2004
Heiko Pliefke <kollateralschaden@_nospam_.net> writes:

> When the innerText of an anchor contains an '@', the InternetExplorer
> changes the innerText-Property to the HREF-Property. I have checked
> this with MoZilla/FireBird and Opera and there is no problem!


Indeed. Whenever IE believes that the content of an anchor element
is itself an URL, assigning to the href of the anchor also changes
the content. It happens if the content contains an "@", but also
if it starts with, e.g., "http://"

I guess it's what they call a "feature"


--
Lasse Reichstein Nielsen - http://www.velocityreviews.com/forums/(E-Mail Removed)
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer 8: C:\Program Files\Internet Explorer\iexplore.exe vs C:\Program Files (x86)\Internet Explorer\iexplore.exe Nathan Sokalski Windows 64bit 16 02-22-2010 08:31 AM
internet explorer 7 - Internet Explorer cannot display the webpag sandy j Windows 64bit 0 05-02-2009 02:12 AM
Pop up with strange behaviour in Internet Explorer but not Firefox. ft310 Javascript 8 06-05-2007 07:43 PM
Strange windows explorer behaviour Peter Huebner NZ Computing 4 10-08-2005 06:43 AM
can surf in Windows Explorer not Internet Explorer Billh Computer Support 0 05-02-2004 08:47 PM



Advertisments