Click to See Complete Forum and Search --> : Give some idea in javascript


anandedward
August 2nd, 2007, 03:38 AM
hi

any one pls help these concept in javascript or coding


"Positioning the scroll-bar as per the selected node in the tree.
( The selcted node should be displayed in the middle of the window with no case expanded or collapse.)"


by
Anand

PeejAvery
August 2nd, 2007, 08:34 AM
You will have to get the position of the node and then set the ScrollTop. The following is code to get the horizontal position of the node.

var obj = document.getElementById(...);
if(obj.offsetParent){
y = obj.offsetTop;
while(obj = obj.offsetParent){
y += obj.offsetTop;
}
}

anandedward
August 3rd, 2007, 12:57 AM
thank u very much ....................these code is working properly............

PeejAvery
August 4th, 2007, 09:53 AM
Glad to hear it. :wave: