Add support for multiple fomrs on the client side in case of TARGET_J2EE portal support.
[mono.git] / mcs / class / System.Web / resources / MaintainScrollPositionOnPostBack.js
1 function WebForm_SaveScrollPositionSubmit() {
2     this.elements['__SCROLLPOSITIONX'].value = WebForm_GetScrollX();
3     this.elements['__SCROLLPOSITIONY'].value = WebForm_GetScrollY();
4     if ((typeof(this.oldSubmit) != "undefined") && (this.oldSubmit != null)) {
5         return this.oldSubmit();
6     }
7     return true;
8 }
9 function WebForm_SaveScrollPositionOnSubmit() {
10     this.elements['__SCROLLPOSITIONX'].value = WebForm_GetScrollX();
11     this.elements['__SCROLLPOSITIONY'].value = WebForm_GetScrollY();
12     if ((typeof(this.oldOnSubmit) != "undefined") && (this.oldOnSubmit != null)) {
13         return this.oldOnSubmit();
14     }
15     return true;
16 }
17 function WebForm_RestoreScrollPosition(currForm) {
18         currForm = currForm || theForm;
19         var ScrollX = currForm.elements['__SCROLLPOSITIONX'].value;
20         var ScrollY = currForm.elements['__SCROLLPOSITIONY'].value;
21         if (ScrollX != "" || ScrollY != "")
22         window.scrollTo(ScrollX, ScrollY);
23     if ((typeof(this.oldOnLoad) != "undefined") && (this.oldOnLoad != null)) {
24         return this.oldOnLoad();
25     }
26     return true;
27 }
28 function WebForm_GetScrollX() {
29     if (window.pageXOffset) {
30         return window.pageXOffset;
31     }
32     else if (document.documentElement && document.documentElement.scrollLeft) {
33         return document.documentElement.scrollLeft;
34     }
35     else if (document.body) {
36         return document.body.scrollLeft;
37     }
38     return 0;
39 }
40 function WebForm_GetScrollY() {
41     if (window.pageYOffset) {
42         return window.pageYOffset;
43     }
44     else if (document.documentElement && document.documentElement.scrollTop) {
45         return document.documentElement.scrollTop;
46     }
47     else if (document.body) {
48         return document.body.scrollTop;
49     }
50     return 0;
51 }