D
delimiter
Hi,
I've just found a really peculiar problem with IE (v 6 and 7) and am
hoping for some help!
I have a javascript function (called immediately before the closing
body tag) that gets all the anchors in a specified div and then will
either update the href or add an onclick event depending on whether
the href is currently set to pdf. If the anchor text contains the @
symbol and there is text preceding the @ then the anchor text is
displayed on screen as the newly updated href. If there is no text
before the @ then it's fine.
Cut down example code below:
/// HTML ////
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function fnLinks() {
var oContent = document.getElementById("content");
if(oContent != null) {
var oATags = oContent.getElementsByTagName("A");
for (i=0; i<oATags.length; i++) {
oATags.href= "http://www.google.com";
}
}
}
</script>
</head>
<body>
<div id="content">
<p><a href="test1.html">Test 1</a></p>
<p><a href="test2.html">@test2.com</a></p>
<p><a href="test3.html">[email protected]</a></p>
<p><a href="test4.html">@test4.com</a></p>
<p><a href="test5.html">[email protected]</a></p>
</div>
<script type="text/javascript">fnLinks();</script>
</body>
</html>
Many thanks
Helen
I've just found a really peculiar problem with IE (v 6 and 7) and am
hoping for some help!
I have a javascript function (called immediately before the closing
body tag) that gets all the anchors in a specified div and then will
either update the href or add an onclick event depending on whether
the href is currently set to pdf. If the anchor text contains the @
symbol and there is text preceding the @ then the anchor text is
displayed on screen as the newly updated href. If there is no text
before the @ then it's fine.
Cut down example code below:
/// HTML ////
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function fnLinks() {
var oContent = document.getElementById("content");
if(oContent != null) {
var oATags = oContent.getElementsByTagName("A");
for (i=0; i<oATags.length; i++) {
oATags.href= "http://www.google.com";
}
}
}
</script>
</head>
<body>
<div id="content">
<p><a href="test1.html">Test 1</a></p>
<p><a href="test2.html">@test2.com</a></p>
<p><a href="test3.html">[email protected]</a></p>
<p><a href="test4.html">@test4.com</a></p>
<p><a href="test5.html">[email protected]</a></p>
</div>
<script type="text/javascript">fnLinks();</script>
</body>
</html>
Many thanks
Helen