S
sri_san
Hi All,
I am working on a script to find the position of a element and
scroll to the element on postback. Here is what I came up with ..
---------------------------------------
function getAbsoluteTop(objectId) {
// Get an object top position from the upper left viewport corner
// Tested with relative and nested objects
o = document.getElementById(objectId);
oTop = o.y ? o.y : o.offsetTop; // Get top position from
the parent object
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the
document element
oParent = o.offsetParent // Get parent object reference
oTop += o.y ? o.y : oParent.offsetTop; // Add parent top position
o = oParent
}
// Return top position
return oTop
}
function scrollElement()
{
var y = getAbsoluteTop('test');
window.scrollTo(1,y);
}
-----------------------------------------
Works fine in Firefox but doesnt in IE6/7. Could anyone point out
what am i missing?
Thanks,
Sam.
I am working on a script to find the position of a element and
scroll to the element on postback. Here is what I came up with ..
---------------------------------------
function getAbsoluteTop(objectId) {
// Get an object top position from the upper left viewport corner
// Tested with relative and nested objects
o = document.getElementById(objectId);
oTop = o.y ? o.y : o.offsetTop; // Get top position from
the parent object
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the
document element
oParent = o.offsetParent // Get parent object reference
oTop += o.y ? o.y : oParent.offsetTop; // Add parent top position
o = oParent
}
// Return top position
return oTop
}
function scrollElement()
{
var y = getAbsoluteTop('test');
window.scrollTo(1,y);
}
-----------------------------------------
Works fine in Firefox but doesnt in IE6/7. Could anyone point out
what am i missing?
Thanks,
Sam.