[Javascript] Firefox and setAttribute

Steve Clason stevec at topdogstrategy.com
Mon Oct 17 21:40:35 CDT 2005


Hi,

Can anyone point me to a good source that explains Firefox's problem 
handling of setAttribute? I keep running into problems and would like to 
take the time to understand what's going on.

Right now, I have this:

<code>
var slide = document.createElement("img");
slide.setAttribute("src","images/image.gif");
slide.setAttribute("alt","this is alt text");
slide.setAttribute("id","slide");
document.appendChild(slide);
</code>

The image element is placed and has an id and alt text attributes, but 
no src.

If I try:

<code>
slide.src = "images/image.gif";
</code>

I get the same thing--no image, but id and alt text.

Both techniques work in IE and Opera so I'm pretty sure this is a FF 
peculiarity.

I'll take all the help I can get on this.

Thanks in advance,

-- 
Steve Clason





More information about the Javascript mailing list