发布网友 发布时间:2022-04-24 01:02
共3个回答
热心网友 时间:2022-04-24 22:47
下面则用javascript实现的非常实用的滚动,你可以修改滚动的方向.
<DIV id=scrollbody>
<DIV id=scrolltext>
your contnet
</di>
</di>
<SCRIPT type=text/javascript>
<!--
try{
var marqueesHeight = 150;
var stopscroll = false;
var scrollElem = document.getElementById("scrollbody");
with(scrollElem){
style.width = 275;
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("scrolltext");
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 == 30){
stoptime += 1;
currentTop -= 1;
if(stoptime == 180){
currentTop = 0;
stoptime = 0;
}
}else{
preTop = scrollElem.scrollTop;
scrollElem.scrollTop += 1;
if(preTop == scrollElem.scrollTop){
scrollElem.scrollTop = 0;
scrollElem.scrollTop += 1;
}
}
}
//-->
</SCRIPT>
<!-- phpstat.sports.cn -->
<SCRIPT language=JavaScript type=text/javascript>
var _PCSWebSite="10000008";
var _PCSText="num1";
</SCRIPT>
热心网友 时间:2022-04-25 00:05
<marquee direction=left >fsafdsd</marquee>
设置滚动方向,修改direction 就可以
热心网友 时间:2022-04-25 01:40
这裏解说的很详细:
http://www.itblo.com/html/webdesign/Dreamweaver/20080217/90_3.html