Jump to content

Recursive HTML DOM navigation


Guest Diplom@t

Recommended Posts

Guest Diplom@t

Hi. I have a task to navigate throug all child nodes od DOM element. If i see INPUT element claer its value. i try tu use this code:function resetinputs (node) { alert ("parentnode: "+node.nodeName); curch = node.firstChild; while (curch) { alert ("1. Parent: "+ node.nodeName +". curchnode="+curch.nodeName+". id="+curch.id+". curch.nexts="+curch.nextSibling); if (curch.nodeName=="INPUT") alert ("input: "+curch.id+". value: "+curch.value); else { alert ("in else curchname="+curch.nodeName); if (curch.nodeName != "#text") { k = resetinputs (curch); alert("after call with "+curch.nodeName); } } curch = curch.nextSibling; alert("ok. parentnode="+node.nodeName); } alert("end of "+node.nodeName); return 1;}i can't find a reason, but the function doesn'y return. I mean, that it goes in my tree and calls resetinputs(), but after it seems to go to return, but it doesn't go to next child in previous call of function :) Please help! What's wrong here?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...