Forum Moderators: open

Message Too Old, No Replies

Why is this code not working in a FireFox?

JavaScripts

         

Keepun

4:11 pm on Dec 7, 2007 (gmt 0)

10+ Year Member



Why is this code not working in a FireFox? Only second attribute 'alt' change :(

<html>
<body>
<a href="fcccf">
<img src="./images/smilies/i2 con_e_sad.gif" alt="text" title="1st img" /><br />
<img src="./127.0.0.1/ddddc.gif" width="100%" height="16%" alt="text 2" title="2nd img" />
</a>
<script language="JavaScript" type="text/javascript">
//var imgs = document.getElementsByTagName("img");
var imgs = document.images;
for (var i = 0; i < imgs.length; i++)
{
alert(imgs[i].title);
//imgs[i].alt = 'img';
imgs[i].setAttribute('alt', 'Alternative string');
}
</script>
</body>
</html>

Xapti

3:55 am on Dec 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is your problem though?

Achernar

1:23 pm on Dec 8, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



Apparently there is a problem in FF when the image has no size attribute. It won't update the display, even if the value in the DOM tree for the "alt" attribute has been updated.
But why do you need to change the alt attribute after the image has been displayed (or not)?

Keepun

10:46 pm on Dec 8, 2007 (gmt 0)

10+ Year Member



This is bug in a Firefox 2.0 but in Firefox 3.0 all OK.