D
David McDivitt
Rather than have several different pages, an app was designed to have
different sections, all on one page. To get to the different sections the
browser is scrolled down. It may take several submits before everything gets
filled out correctly. The user complained because the page would not scroll
to the previous position, code was installed to save and restore the page
position, but it doesn't always go to the same place. Sometimes it does.
Sometimes it doesn't. Two text boxes are used to save position, and the page
is regenerated with x and y as literals by the server. The problem seems to
be what values are saved as the page is submitted. A better idea or fix
would be appreciated. Thanks
function windowRestore() {
var x=<%="0"+xPos%>;
var y=<%="0"+yPos%>;
if (top.opera && (typeof window.pageYOffset != 'undefined')) {
window.pageXOffset = x;
window.pageYOffset = y;
}
else if (window.document.compatMode && (window.document.compatMode !=
'BackCompat')) {
window.document.documentElement.scrollLeft = x;
window.document.documentElement.scrollTop = y;
}
else window.scrollBy(x,y);
}
function windowSave() {
var x, y;
if (typeof window.pageXOffset != 'undefined') {
x = window.pageXOffset;
y = window.pageYOffset;
}
else {
if ((!window.document.compatMode) || (window.document.compatMode ==
'BackCompat')) {
x = window.document.body.scrollLeft;
y = window.document.body.scrollTop;
}
else {
x = window.document.documentElement.scrollLeft;
y = window.document.documentElement.scrollTop;
}
}
document.ArtRec.windowXPos.value = x;
document.ArtRec.windowYPos.value = y;
}
different sections, all on one page. To get to the different sections the
browser is scrolled down. It may take several submits before everything gets
filled out correctly. The user complained because the page would not scroll
to the previous position, code was installed to save and restore the page
position, but it doesn't always go to the same place. Sometimes it does.
Sometimes it doesn't. Two text boxes are used to save position, and the page
is regenerated with x and y as literals by the server. The problem seems to
be what values are saved as the page is submitted. A better idea or fix
would be appreciated. Thanks
function windowRestore() {
var x=<%="0"+xPos%>;
var y=<%="0"+yPos%>;
if (top.opera && (typeof window.pageYOffset != 'undefined')) {
window.pageXOffset = x;
window.pageYOffset = y;
}
else if (window.document.compatMode && (window.document.compatMode !=
'BackCompat')) {
window.document.documentElement.scrollLeft = x;
window.document.documentElement.scrollTop = y;
}
else window.scrollBy(x,y);
}
function windowSave() {
var x, y;
if (typeof window.pageXOffset != 'undefined') {
x = window.pageXOffset;
y = window.pageYOffset;
}
else {
if ((!window.document.compatMode) || (window.document.compatMode ==
'BackCompat')) {
x = window.document.body.scrollLeft;
y = window.document.body.scrollTop;
}
else {
x = window.document.documentElement.scrollLeft;
y = window.document.documentElement.scrollTop;
}
}
document.ArtRec.windowXPos.value = x;
document.ArtRec.windowYPos.value = y;
}