日期:2014-05-16  浏览次数:20389 次

(JS特效)鼠标上滚动字体
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>测试滚动上下文字</title>
</head>

<body>
<div id="marquees">
<marquee id="mar" scrollAmount=2 width=300 onmouseover="a()" onmouseout="b()">看我会动啦</marquee>
</div>
<!-- 以下是javascript代码 -->
<script language="javascript">
function a(){
document.getElementById("mar").stop();
}
function b(){
document.getElementById("mar").start();
}
</script>
</body>
</html>



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

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>鼠标滚动上下文字</title>
<!-- 把下列代码放到<head>区域中-->
<STYLE type=text/css>BODY {
MARGIN: 25px 25px 25px
}
#all TD {
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","新宋体", "宋体"
}
#all A:active {
COLOR: #7d070c
}
#all A:visited {
COLOR: #7d070c
}
#all A:hover {
COLOR: #336699
}
#all A:link {
COLOR: #7d070c
}
</STYLE>

<script language="JavaScript1.2">
//1) 设置显示的内容
var scroller_msg='欢迎你的光临'
//2) 设置多长时间后才显示滚动的内容

var dismissafter=0

var initialvisible=0

if (document.all)

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

function followcursor(){
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

}
function dismissmessage(){
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>