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.scr ollTop;
}
//--></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!
<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.scr
}
//--></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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The problem was that your function did not reference the document.body correctly for Netscape.
Your syntax works only in IE.
Your syntax works only in IE.
Does it now work for you with my script version?
ASKER
Thanks for the reply!