TheRoper
06-25-2004, 05:20 AM
hello folks-
all of my questions lately seem to be about roughly the same thing... :rolleyes:
i have a scrollable div on this site (http://www.charityadvantage.com/familiesintransitionsantacruz/images/mock2.htm). i already got help on how to scroll the div to the top with an internal link like:
<a href='#' onclick="document.all['layerName'].scrollTop = 0;return false">top</a>
on a recent project, i learned about being able to scroll smoothly to the top, as opposed to just jumping to the top. My question is why doesn't this work?
<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript"><!--
var top_t;
function top() {
if (document.all['content'].scrollTop!=0){
document.all['content'].scrollBy(0,-10);
top_t=setTimeout('top()',10);
}
else clearTimeout(top_t);
}
//--></SCRIPT>
</HEAD>
<BODY>
<DIV id="content">Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text.
<a href="#" onClick="top();return false">top</a>
</DIV>
</BODY>
the error i get is: "object does not support this property or method" so can i simply not use "scrollBy" within a div... if so, are there any suggestions?
thanks :cool:
all of my questions lately seem to be about roughly the same thing... :rolleyes:
i have a scrollable div on this site (http://www.charityadvantage.com/familiesintransitionsantacruz/images/mock2.htm). i already got help on how to scroll the div to the top with an internal link like:
<a href='#' onclick="document.all['layerName'].scrollTop = 0;return false">top</a>
on a recent project, i learned about being able to scroll smoothly to the top, as opposed to just jumping to the top. My question is why doesn't this work?
<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript"><!--
var top_t;
function top() {
if (document.all['content'].scrollTop!=0){
document.all['content'].scrollBy(0,-10);
top_t=setTimeout('top()',10);
}
else clearTimeout(top_t);
}
//--></SCRIPT>
</HEAD>
<BODY>
<DIV id="content">Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text. Space filler text.
<a href="#" onClick="top();return false">top</a>
</DIV>
</BODY>
the error i get is: "object does not support this property or method" so can i simply not use "scrollBy" within a div... if so, are there any suggestions?
thanks :cool: