Js double click mouse automatically scroll screen sample code
- 2020-03-30 00:56:23
- OfStack
As follows:
<html>
<head>
<script language="javascript" type="text/javascript">
//Double-click to scroll through the code on the screen
var currentpos,timer;
function initialize()
{
timer=setInterval("scrollwindow()",30);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if(currentpos !=document.body.scrollTop)
{
sc();
}
}
document.onmousedown=sc; // stop
document.ondblclick=initialize; // start
</script>
</head>
<body>
<%
for i=1 to 100
%>
<p> Double-click the screen to scroll Js code </p>
<%
next
%>
</body>
</html>