Link to home
Start Free TrialLog in
Avatar of bda01
bda01

asked on

Scrolltop and onscroll javascript for firefox

We use a javascript function to postback (asp.net) to the same position on the page. This function does not seem to work with Firefox -- i think its because onscroll is not recognized.

<BODY ID="Body" runat="server" ONSCROLL="bodyscroll()" BOTTOMMARGIN="0" LEFTMARGIN="0"
            TOPMARGIN="0" RIGHTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">

<script language="JavaScript"><!--
         function bodyscroll() {
           var F=document.forms[0];
           F.ScrollTop.value=Body.scrollTop;
         }
         //--></script>

<INPUT ID="ScrollTop" runat="server" NAME="ScrollTop" TYPE="hidden">

Can someone recommend the best way to modify this script to work with firefox and safari also?

Thanks for any tips!
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bda01
bda01

ASKER

I don't understand how this would help... I was under the impression that the OnScroll in the form tag was what was causing issues...

Thanks for the reply!
The problem was that your function did not reference the document.body correctly for Netscape.
Your syntax works only in IE.
Does it now work for you with my script version?