SCROLLABLE DIV CONTENTS WHEN MOUSE OVER THE SCROLL UP AND SCROLL DOWN LINKSSCROLLABLE DIV CONTENTS WHEN MOUSE OVER THE UP AND DOWN LINKS The top-level function, escape, encodes the string that is contained in the string argument to make it portable. A string is considered portable if it can be transmitted across any network to any computer that supports ASCII characters. We can use escape function in JavaScript to make a string portable to transmit it over a network. All the non ASCII characters are to be converted before sending them by using escape function. The escape function will replace these non ASCII characters to its two or four digit hex format.Scroll Up Scroll Down
Here Code
<html>
<script type="text/javascript">
var scrolling = null;
var _speed = 12;
function doScrollUp()
{
var d = document.getElementById('scroller');
d.scrollTop = d.scrollTop - _speed;
scrolling = window.setTimeout(function() {
doScrollUp();
}, 100);
}
function doScrollDown()
{
var d = document.getElementById('scroller');
d.scrollTop = d.scrollTop + _speed;
scrolling = window.setTimeout(function() {
doScrollDown();
}, 100);
}
function doStopScroll()
{
window.clearTimeout(scrolling);
}
</script>
<body>
<h2>SCROLLABLE DIV CONTENTS WHEN MOUSE OVER THE UP AND DOWN LINKS</h2>
<div id="scroller" style="width:100%; height:100px; overflow:hidden;">
SCROLLABLE DIV CONTENTS WHEN MOUSE OVER THE UP AND DOWN LINKS
<br /><br /><br />
The top-level function, escape, encodes the string that is contained in <br /><br />
the string argument to make it portable. A string is considered portable <br /><br />
if it can be transmitted across any network to any computer that
supports ASCII characters.<br />
We can use escape function in JavaScript to make a string portable
to transmit it over a network. All the non ASCII characters are to be <br />
converted before sending them by using escape function. The escape function <br />
will replace these non ASCII characters to its two or four digit hex format.<br />
<br /><br /><br /><br />
</div>
<div>
<span style="color:red;" onmouseover="doScrollUp();" onmouseout="doStopScroll();" style="padding-right:10px;">Scroll Up</span>
<span style="color:blue;" onmouseover="doScrollDown();" onmouseout="doStopScroll();">Scroll Down</span>
</div>
</body>
</html>
No comments:
Post a Comment