473,386 Members | 1,699 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,386 software developers and data experts.

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

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

Jul 20 '05 #1
2 1861
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 - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Lasse Reichstein Nielsen wrote:
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" :)


Hello!

Thank you for your answer!
A very nice feature :-/ , it could be useful, when href and innerText
has same value, but in my case I have to work around this "feature".

Best regards,

Heiko Pliefke
Jul 20 '05 #3

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

Similar topics

7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
4
by: Torsten Reiners | last post by:
Hi, it might be a simple solution but I do not see it. The problem is that I have the following file stored on my local harddrive. All references are URL to a remote computer. It is working,...
2
by: Koh | last post by:
My rollover image effect work fine in Netscape but not in Internet Explorer. Is there any important element or tag that I have miss out so it is not working in Internet Explorer? Below is my code,...
2
by: June Moore | last post by:
I have a page with an IFRAME. When I tried to dynamically set the location.href of the IFRAME to a URL address, the Internet Explorer browser loads the page onto the IFRAME correctly but a very...
11
by: ft310 | last post by:
Use Internet Explorer go to http://rhodeisland-aa.org/tester/meetings/index.htm On the left click "and go to meetings" Click any address in the right hand 'location' column. The entire page...
7
by: Danny | last post by:
Hello: I would like to develop a browser extension, or whatever such a thing is classified as, that would allow a user of IE6, and possibly IE7, to switch between a live and development page. ...
8
by: mumpi | last post by:
From a documentlist the user activates links to see the document in a popup. The link (JSP): <a href='javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);w.focus();'> ...
1
by: Jahamos | last post by:
Background: I have copy and pasted an Excel flowchart into a Dreamweaver html page. I created a frame on the top of the page as a viewer. I created hotspot links over the flowchart items. Each...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.