求一段js代码 垂直滚动的代码?类似于http://www.yobo.com/中的垂直滚动,中间有间歇的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没看到你说的那种效果MSClass(通用不间断滚动JS封装类)搜索下上面的吧,或许对你有用 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无缝滚动</title> </head> <body> <style>a{display:block;font-size:15px};</style> <div id="div1" style="width:300px;height:68px;overflow:hidden"> <div id="div2" style="margin-top:0px;line-height:20px;"> <a href="javascript:">1,你可曾有过无数的梦想,</a> <a href="javascript:">2,却在时光的流逝里幻灭 </a> <a href="javascript:">3,你可曾对未来期待憧憬,</a> <a href="javascript:">4,却在成长的岁月中迷失</a> <a href="javascript:">5,CSDN中国程序员论坛</a> <a href="javascript:">6,大家一起来</a> <a href="javascript:">7,好象都很不错的样子</a> </div> </div> <input type=text id=text1> <script> var bb; function scrolln(id,samont,step){ var d=document.getElementById(id); if(!d.scrolln) { if(step) { d.step=step;d.samont=samont; } d.scrolln=setInterval("scrolln('"+id+"')",d.samont);//不同的是setTimeout()是一次性作用,而setInterval()是每隔iMilliSeconds就执行一次 d.onmouseover=function() { clearInterval(this.scrolln); this.scrolln=null; } d.onmouseout=function() { scrolln(this.id) } } var top=parseInt(d.style.marginTop); // 方法用于字符串转换为数字 var lineheight=parseInt(d.style.lineHeight); if(top>-lineheight) { d.style.marginTop=(top-d.step)+"px"; //text1.value= d.style.marginTop+"/"+top+"/"+lineheight+"/"+d.step+"/"+d.firstChild; } else { do { var o=d.firstChild; d.removeChild(o); d.appendChild(o); } while(!d.firstChild.tagName) d.style.marginTop="0px"; }}//第一个参数为要滚动块的标签id,第二个参数为滚动间隔时间,第三个参数为滚动距离px scrolln("div2",100,1); </script> </body> </html> 统计网页访问次数 网站挂在万网,可以发送以租的服务器作为邮件服务器发送邮件么? 为什么在使用Word生成对象时提示输入用户名和密码? 关于updatepanel的问题 初学者的问题 保存前页面的内容 项目合并问题???? 在选择多项记录时有没有像ListBox那样鼠标一点然后以拖拉就全部选中的控件! 从数据库读出来的内容,用什么控件显示才能保持原有的输入之时的格式? asp.net用户登录判断 用UpdatePanel下做的注册页,点击button后怎么跳转到提示用的label标签 弹出新窗体 急!<asp:TextBox>控件怎么进行客户端验证? 怎么调用JavaScript函数?
MSClass(通用不间断滚动JS封装类)
搜索下上面的吧,或许对你有用
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无缝滚动</title>
</head>
<body>
<style>a{display:block;font-size:15px};</style>
<div id="div1" style="width:300px;height:68px;overflow:hidden">
<div id="div2" style="margin-top:0px;line-height:20px;">
<a href="javascript:">1,你可曾有过无数的梦想,</a>
<a href="javascript:">2,却在时光的流逝里幻灭 </a>
<a href="javascript:">3,你可曾对未来期待憧憬,</a>
<a href="javascript:">4,却在成长的岁月中迷失</a>
<a href="javascript:">5,CSDN中国程序员论坛</a>
<a href="javascript:">6,大家一起来</a>
<a href="javascript:">7,好象都很不错的样子</a>
</div> </div>
<input type=text id=text1>
<script>
var bb;
function scrolln(id,samont,step)
{
var d=document.getElementById(id);
if(!d.scrolln)
{ if(step)
{ d.step=step;d.samont=samont;
}
d.scrolln=setInterval("scrolln('"+id+"')",d.samont);//不同的是setTimeout()是一次性作用,而setInterval()是每隔iMilliSeconds就执行一次
d.onmouseover=function()
{
clearInterval(this.scrolln);
this.scrolln=null;
}
d.onmouseout=function()
{
scrolln(this.id)
}
}
var top=parseInt(d.style.marginTop); // 方法用于字符串转换为数字
var lineheight=parseInt(d.style.lineHeight); if(top>-lineheight)
{
d.style.marginTop=(top-d.step)+"px";
//text1.value= d.style.marginTop+"/"+top+"/"+lineheight+"/"+d.step+"/"+d.firstChild;
}
else
{
do
{
var o=d.firstChild;
d.removeChild(o);
d.appendChild(o);
}
while(!d.firstChild.tagName)
d.style.marginTop="0px";
}
}
//第一个参数为要滚动块的标签id,第二个参数为滚动间隔时间,第三个参数为滚动距离px
scrolln("div2",100,1);
</script>
</body>
</html>