Forum Moderators: open
having a bit of problems with IE again.. as per normal, anyone know where the developers live? i have something to send them - a brick ... grrrrrr
ok moan over..
but simply i am using
x=document.createElement("div");
x.setAttribute("class","classname");
and then appendchild etc to add them to the page.
which of course works a treat in FF, and does actually add the elements into the page in IE, but does it add the class details..? does it *%$!
and then i have a problem with trying to remove them from the page again with removeNode
ive added the elements in , and given them a holding div called .. question_1, question_2 etc..
so i do
document.getElementByID("question_1").removeNode(true);
using true to bin all the child nodes also.
but this refuses to work in FF or IE, so im lost there.
if i alert the doc.getElById("question_1") it has found a div.. hoorah
so why when i do x = doc.blahthing and then x.removeNode(true) does ti not work?!
i do like JS, but it isnt half a bugger when it doesnt play ball..
any help with this rant much appreciated as per..
cheers all
nat
I've had much more success with
x.className = "whatever";
Not sure about the removeNode thing, but your post is hard to understand. Post the actual code so we can read it.
IIRC:
document.getElementByID("question_1").removeNode(true);
will remove all direct children of "question_1" and will set all those childrens children to be a child of "question_1". You can put is this way: The removeNode method just removes the specified element and makes its descendents children of their grandfather.
If that makes sense :)
- JS