Click to See Complete Forum and Search --> : Destroy div object


mak123
04-11-2006, 10:19 PM
I have script use to embed Flash object into HTML page (Flash Media Server).
I created div tags to contain them with seperate id for each.
When I destroy one div tag. (Call javascript function from Flash to destroy). It destroys all div objects in page (Firefox). this is wrong. Although it's right in IE.
I don't know why. Anyone knows it?

hyperlisk
04-11-2006, 11:20 PM
DIVtoRemove = document.getElementById("removeMe");
document.body.removeChild(DIVtoRemove);

Try that.

mak123
04-11-2006, 11:40 PM
thks hyperlisk
I did like that, if you call this function from your page, it's ok (firefox + ie), but when you call function from Flash Media, it's error.
I can't understand.
So which is different between call javascript function from Flash and site?
It makes me very confused

hyperlisk
04-11-2006, 11:44 PM
I do not know. I have no experience with Flash...

Kor
04-12-2006, 03:10 AM
When removing a childNode you must remove it from its direct parent, or body might not be the direct parent of that div. Try this

var DIVtoRemove = document.getElementById("removeMe");
DIVtoRemove.parentNode.removeChild(DIVtoRemove);