(JS特效)鼠标上滚动字体

<html>

<head>

<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>

<title>测试滚动上下文字</title>

</head>

<body>

<divid="marquees">

<marqueeid="mar"scrollAmount=2width=300onmouseover="a()"onmouseout="b()">看我会动啦</marquee>

</div>

<!--以下是javascript代码-->

<scriptlanguage="javascript">

functiona(){

document.getElementById("mar").stop();

}

functionb(){

document.getElementById("mar").start();

}

</script>

</body>

</html>

****************************************************

<html>

<head>

<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>

<title>鼠标滚动上下文字</title>

<!--把下列代码放到<head>区域中-->

<STYLEtype=text/css>BODY{

MARGIN:25px25px25px

}

#allTD{

FONT-SIZE:12px;LINE-HEIGHT:15px;FONT-FAMILY:"Verdana","Arial","新宋体","宋体"

}

INPUT{

FONT-SIZE:12px;LINE-HEIGHT:15px;FONT-FAMILY:"Verdana","Arial","新宋体","宋体"

}

SELECT{

FONT-SIZE:12px;LINE-HEIGHT:15px;FONT-FAMILY:"Verdana","Arial","新宋体","宋体"

}

P{

FONT-SIZE:12px;LINE-HEIGHT:15px;FONT-FAMILY:"Verdana","Arial","新宋体","宋体"

}

TEXTAREA{

FONT-SIZE:12px;LINE-HEIGHT:15px;FONT-FAMILY:"Verdana","Arial","新宋体","宋体"

}

#allA:active{

COLOR:#7d070c

}

#allA:visited{

COLOR:#7d070c

}

#allA:hover{

COLOR:#336699

}

#allA:link{

COLOR:#7d070c

}

</STYLE>

<scriptlanguage="JavaScript1.2">

//1)设置显示的内容

varscroller_msg='欢迎你的光临'

//2)设置多长时间后才显示滚动的内容

vardismissafter=0

varinitialvisible=0

if(document.all)

document.write('<marqueeid="curscroll"style="position:absolute;width:150px;border:1pxsolidblack;font-size:14px;background-color:white;visibility:hidden">'+scroller_msg+'</marquee>')

functionfollowcursor(){

if(initialvisible==0){

curscroll.style.visibility="visible"

initialvisible=1

}

curscroll.style.left=document.body.scrollLeft+event.clientX+10

curscroll.style.top=document.body.scrollTop+event.clientY+10

}

functiondismissmessage(){

curscroll.style.visibility="hidden"

}

if(document.all){

document.onmousemove=followcursor

document.ondblclick=dismissmessage

if(dismissafter!=0)

setTimeout("dismissmessage()",dismissafter*1000)

}

//-->

</script>

</head>

<body>

</body>

</html>

相关推荐