this is a really hard issue for me, which trun out tormenting me a few days!!!
at the beginning, i used document.body.onscroll event,
document.body.onscroll=setBackToTop;
function setBackToTop()
{
var theTop=0;
var isIE=document.all? true:false;
if(isIE)
{
if (document.documentElement && document.documentElement.scrollTop)
theTop = document.documentElement.scrollTop;
else
theTop = document.body.scrollTop;
if(theTop>0)
document.getElementById("backtotop").style.display="inline";
else
document.getElementById("backtotop").style.display="none";
}
else
{
if(window.scrollbars.visible)
document.getElementById("backtotop").style.display="inline";
else
document.getElementById("backtotop").style.display="none";
}
}
it works perfect in IE, how ever,ineffective in the FireFox
then I doubt every line of my code except "document.body.onscroll"
at last , some say:
window.onscroll is supported by IE5+, Firefox, Mozilla 1+, Opera 7+, Netscape 7+.
document.body.onscroll is supported by IE6+, Opera 7+.
God! then , I make "window.onscroll" take place of "document.body.onscroll" , then my control "back to up " would like to display as my wishes.