鼠标双击页面后,页面向右滚动,到边后会停止,再双击后回转

- 站长中国 (http://www.zzchina.net)
-- 网页特效 (http://www.zzchina.net/javascript/)
--- 鼠标双击页面后,页面向右滚动,到边后会停止,再双击后回转 (http://www.zzchina.net/javascript/1/755.htm)
-- 发布日期: 2005-07-06
<!-- 网页特效代码由[站长中国:http://www.zzChina.net]提供! -->
<!-- 要实现此效果需要 1 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<table border=5 bordercolor=blue borderlight=green>
<tr><td align=center><font size=3 color=red face="Arial, Helvetica, sans-serif"><strong>下面为效果显示</strong></font></td></tr>
<tr><td align=center>
<pre>鼠标双击滚动,单击停止滚动,滚动到边后仍不停滚动,会自动回转滚动......鼠标双击滚动,单击停止滚动,滚动到边后仍不停滚动,会自动回转滚动......鼠标双击滚动,单击停止滚动,滚动到边后仍不停滚动,会自动回转滚动......</pre>

<script>

function document.body.onselectstart()
{
return false;
}



var move_time = null;

var move_direction = 1;

function document.ondblclick()
{
move_time = setInterval("move_scroll()",100);
}



function move_scroll()
{
if(document.body.scrollLeft==0||(document.body.scrollWidth - document.body.scrollLeft)==document.body.clientWidth)
{
move_direction *= -1;
}

window.scrollBy(move_direction,0)
}

function document.onclick()
{
clearInterval(move_time)
}

</script>

</td></tr>
</table></center>
<br>
<br>
<br><br>
<br>
<center>
<textarea name=source rows=12 cols=45 class=yk9>
脚本说明:
把如下代码加入<body>区域中
<pre>11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222221</pre>

<script>

function document.body.onselectstart()
{
return false;
}



var move_time = null;

var move_direction = 1;

function document.ondblclick()
{
move_time = setInterval("move_scroll()",100);
}



function move_scroll()
{
if(document.body.scrollLeft==0||(document.body.scrollWidth - document.body.scrollLeft)==document.body.clientWidth)
{
move_direction *= -1;
}

window.scrollBy(move_direction,0)
}

function document.onclick()
{
clearInterval(move_time)
}

</script>

</textarea>
<SCRIPT LANGUAGE="JavaScript">

<!-- hide

function goHist(a)

{

history.go(a);

}

//-->

</script>

<FORM METHOD="post">
<INPUT TYPE="button" VALUE="返回" onClick="goHist(-1)" style="background-color: #8000FF; color: rgb(255,255,255)">
</form>
</center>

zzchina.net