R
ree321
When I am using Strict Mode HTML declaration
http://www.w3.org/TR/html4/strict.dtd
I am having issues with setting the scroll poistion in the onload
functions
onLoad="startBodyScroll();monitorBodyScroll();"
I use to two javascript functions to keep & set the scroll position on
a page.
//This sets the scroll position of the window to the value specified
in the hidden input
function startBodyScroll(){
var strPos =
document.getElementById("inpHidScrollPage").value;
if (document.documentElement &&
document.documentElement.scrollTop)
{
document.documentElement.scrollTop = strPos;
}
else {
document.body.scrollTop = strPos;
}
}
//This tells the page to let SetBodyPosition run when the window is
scrolled
function monitorBodyScroll(){
window.onscroll = SetBodyPosition;
}
// This records the scroll position od the scroll to hiddeninput
function SetBodyPosition(){
var inpHidName = "inpHidScrollPage";
var intY = 0;
if (document.documentElement &&
document.documentElement.scrollTop)
{
intY = document.documentElement.scrollTop;
}
else {
intY = document.body.scrollTop;
}
document.getElementById(inpHidName).value = intY;
}
Eventhough startBodyScroll() is run it is not able to set the scroll
position. But if I run a client side script in the ASP.net code.
The startBodyScroll() is able to set scroll position.
eg. this sets focus to a textbox
strS = "<SCRIPT
language='javascript'>document.getElementById('" + ctrlID +
"').focus();document.getElementById('" +
ctrlID + "').select();</SCRIPT>"
RegisterStartupScript("focus", strS)
THis happens in IE and Firefox.
Using ASP.net 1.1
http://www.w3.org/TR/html4/strict.dtd
I am having issues with setting the scroll poistion in the onload
functions
onLoad="startBodyScroll();monitorBodyScroll();"
I use to two javascript functions to keep & set the scroll position on
a page.
//This sets the scroll position of the window to the value specified
in the hidden input
function startBodyScroll(){
var strPos =
document.getElementById("inpHidScrollPage").value;
if (document.documentElement &&
document.documentElement.scrollTop)
{
document.documentElement.scrollTop = strPos;
}
else {
document.body.scrollTop = strPos;
}
}
//This tells the page to let SetBodyPosition run when the window is
scrolled
function monitorBodyScroll(){
window.onscroll = SetBodyPosition;
}
// This records the scroll position od the scroll to hiddeninput
function SetBodyPosition(){
var inpHidName = "inpHidScrollPage";
var intY = 0;
if (document.documentElement &&
document.documentElement.scrollTop)
{
intY = document.documentElement.scrollTop;
}
else {
intY = document.body.scrollTop;
}
document.getElementById(inpHidName).value = intY;
}
Eventhough startBodyScroll() is run it is not able to set the scroll
position. But if I run a client side script in the ASP.net code.
The startBodyScroll() is able to set scroll position.
eg. this sets focus to a textbox
strS = "<SCRIPT
language='javascript'>document.getElementById('" + ctrlID +
"').focus();document.getElementById('" +
ctrlID + "').select();</SCRIPT>"
RegisterStartupScript("focus", strS)
THis happens in IE and Firefox.
Using ASP.net 1.1