Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Location

nikos's Achievements


Newbie (1/7)



  1. Thank you very much Ingolme, you helped me alot. If it is necessary this thread can be closed.
  2. I mean that if we have this code below, and oNode points to <p> element Using fnGetSibling it will return a reference to <h1>. What previousSibling would do in this case? <html> <head> <title>DOM Tutorial</title> </head> <body> <h1>DOM Lesson one</h1> <p>Hello world!</p> </body> </html>
  3. I have read these tutorials, I also have tried myself their examples which were very helpful. I just read the DOM Navigation tutorial and I think it will return the previous brother of oNode and not the Parent, which is called previousSibling if I'm not mistaken. If this is correct, if oNode is number 1 child as you said in a previous post (like i imagined it in the picture), this means that there will be an error, right?
  4. Hello Ingolme and thank you for your answer, It helped me alot understanding this code. oNode should be a reference in DOM tree as you said. I have imagined it like this . So in return statement do we actually get a reference to Parent? What do you mean and it doesn't account for oNode being the first child in its parent?
  5. Hello, I found a function called fnGetSibling on https://msdn.microsoft.com/en-us/library/ms533043(v=vs.85).aspx#navigate and I was hoping to understand what it does return and why. var oPrevious = fnGetSibling(); function fnGetSibling(){ var oParent=oNode.parentElement; var iLength=oParent.children.length; for(var i=0;i < iLength;i++){ if(oParent.children[i]==oNode){ return oParent.children[i - 1]; break; } } } I have three possible options: 1. Finds and returns a reference to all childs of a node of DOM Tree. 2. Finds and returns a reference to one of the children of a node of DOM Tree. 3. Finds and returns a reference to a father of a node of DOM Tree. You are not solving any homework (it's summer), it's just from a quiz.
  • Create New...