中文(简体)
网页特效代码,按一定时间向上滚动的文本信息,可以当做网站公告!或者其它别的新闻等!!时间可以自己设定。
<html> <title>按一定时间向上滚动的文本信息!downcodes.com</title> <style type="text/css"> <!-- /*顶部滚动秀*/ #scrolllayer {float:left;overflow:hidden;height:18px;background:#E0E0E0;padding:0px;width:180px; margin-top:3px;} #scrollmessage {float:left;text-align:left;width:180px;font-size:12px;font-family: "宋体";} #scrollmessage ul {list-style:none; padding:0; margin:0;} #scrollmessage li {line-height:18px;color:#FF0000;} #scrollmessage li a{color:#FF0000; text-decoration:none;} --> </style> </head> <body> <div id="scrolllayer"> <div id="scrollmessage"> <ul> <li><a href="http://www.downcodes.com" target="_blank" title="[上海电影节] 跟女明星学扮靓之道">上海电影节女明星</a></li> <li><a href="http://www.downcodes.com" target="_blank" title="20款简约北欧风格经典样板房">20款简约北欧风格经典样板房</a></li> <li><a href="http://www.downcodes.com" target="_blank" title="天生明星脸的天使们">天生明星脸的天使们!</a></li> <li><a href="http://www.downcodes.com" target="_blank" title="多吃四种食物防晒更高效">多吃四种食物防晒更高效</a></li> <li><a href="http://www.downcodes.com" target="_blank" title="该给妆容换夏装啦!">脸蛋也要换“夏妆”</a></li> </ul> </div> </div> <script type="text/javascript" language="javascript"> <!-- //以下参数请勿修改 try{ var marqueesHeight = 18; //高度 var stopscroll = false; var scrollElem = document.getElementById("scrolllayer"); with(scrollElem){ style.width = 180;//宽度 style.height = marqueesHeight; style.overflow = 'hidden'; noWrap = true; } scrollElem.onmouseover = new Function('stopscroll = true'); scrollElem.onmouseout = new Function('stopscroll = false'); var preTop = 0; var currentTop = 0; var stoptime = 0; var leftElem = document.getElementById("scrollmessage"); scrollElem.appendChild(leftElem.cloneNode(true)); init_srolltext(); }catch(e) {} function init_srolltext(){ scrollElem.scrollTop = 0; setInterval('scrollUp()', 15); //滚动速度 } function scrollUp(){ if(stopscroll) return; currentTop += 1; if(currentTop == 19) { //滚动距离 stoptime += 1; currentTop -= 1; if(stoptime == 220) { //停顿时间 currentTop = 0; stoptime = 0; } }else{ preTop = scrollElem.scrollTop; scrollElem.scrollTop += 1; if(preTop == scrollElem.scrollTop){ scrollElem.scrollTop = 0; scrollElem.scrollTop += 1; } } } //--> </script> </body> </html>