144、鼠标控制滚动文字

144、鼠标控制滚动文字

脚本说明:

第一步:把如下代码加入<head>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var ostat = false;

function scrollstop() {

news.scrollAmount = 0;

ostat = true;

}

function scrollplay() {

news.scrollAmount = 5;

ostat = false;

}

function scrolldir() {

mid = screen.width / 2;

mouse = event.x;

if(mouse > mid) {

if(ostat == false) {

speed = (mouse - mid) / 25;

news.scrollAmount = speed;

}

news.direction = "right";

}

else {

if(ostat == false) {

speed = (mid - mouse) / 25;

news.scrollAmount = speed;

}

news.direction = "left";

   }

}

//  End -->

</script>

 

 

第二步:把如下代码加入<body>区域中

<marquee name=news id=news behavior=scroll direction=left scrollamount=5 scrolldelay=1 hspace=0 vspace=0 onmouseover="scrollstop()" onmouseout="scrollplay()">

<b>7stk.com欢迎你的光临,请多提意见,谢谢</b>

</marquee>

 

 

 

第三步:把<body>中的内容改为:

<body onMouseMove="scrolldir()">

 

Write a comment

Comments: 0