Results 1 to 3 of 3
Thread: object.appendChild not working
Jul 23, 2006, 09:41 #1
object.appendChild not working
tmp = document.createElement('div'); tmp.setAttribute('id', 'caption' + captions); tmp.setAttribute('class', 'caption'); txt = document.createTextNode('My Caption!'); tmp.appendChild(txt); image.appendChild(tmp);
I recieve no error when the script executes, and it reaches this part of the script because I've alerted tmp and image, they both read as [Object HTMLDivElement]
Jul 23, 2006, 10:41 #2
- Join Date
- May 2006
- Ventura, CA
- 0 Post(s)
- 0 Thread(s)
Jul 23, 2006, 10:48 #3
What if the image is already an element visible in the body?
Edit, that worked but it puts it to the end of the body. I suppose I can insertBefore and remove the old one..