怎样用jsp实现文字滚动!

怎样用jsp实现文字滚动!,第1张

用js就行了

<html>

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">

<title>连续向左滚动</title>

<style type="text/css">

<!--

body {font-size: 9ptcolor: #000000}

a {color: #0000FFtext-decoration: none}

a:hover {color: #FF0000text-decoration: underline}

-->

</style>

</head>

<body>

<div id="marquees">

天使之城,呀呀!嘿!飞洒发萨地方萨贩毒阿开工;拉萨交流;个了;阿哥

</div>

<div id="templayer" style="position:absoluteleft:0top:0visibility:hidden"></div>

<script language="JavaScript">

marqueesWidth=200

with(marquees){

style.height=0

style.width=marqueesWidth

style.overflowX="hidden"

style.overflowY="visible"

noWrap=true

onmouseover=new Function("stopscroll=true")

onmouseout=new Function("stopscroll=false")

}

preLeft=0currentLeft=0stopscroll=false

function init(){

templayer.innerHTML=""

while(templayer.offsetWidth<marqueesWidth){

templayer.innerHTML+=marquees.innerHTML

}

marquees.innerHTML+=templayer.innerHTML

setInterval("scrollLeft()",10)

}init()

function scrollLeft(){

if(stopscroll==true) return

preLeft=marquees.scrollLeft

marquees.scrollLeft+=1

if(preLeft==marquees.scrollLeft){

marquees.scrollLeft=templayer.offsetWidth-marqueesWidth+1

}

}

</script>

</body>

</html>

<body>

<div id="s1" class="scroll">

<div align= "left">

<marquee behavior = "scroll" direction = "left" behavior = "scroll">

1.****系列火爆促销中。 </br>

2.****即将上市,欢迎品尝。 </br>

3.本地特产全新推出,敬请关注。

</marquee>

</div>

</div>

</body>

文字移动的方向可以改变,入:right ,up ,down等。 behavior = scroll 就可以一圈一圈走了


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11538060.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存