<html>
<head>
<meta charset="UTF-8">
<title>信息滚动条</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
ul{
list-style: none;
}
a {
color: #333;
text-decoration: none; /* 超链接样式 */
}
a:hover {
color: #ff0000;
}
.info-box{
width: 300px;
height: 200px;
margin: 150px auto;
border: 2px solid gray;
border-radius: 25px;
background: pink;
overflow: hidden;
}
.box-title{
width:100%;
height: 40px;
line-height: 40px;
background: yellow;
border-top-left-radius: 25px;
border-top-right-radius:25px;
color:gray;
font-size: 20px;
text-indent: 35px;
overflow: hidden;
}
#box_content{
width: 240px;
height: 240px;
margin: 0 auto;
background: green;
}
#box_content ul li{
height: 40px;
}
#box_content ul li a{
float: left;
display: block;
width: 180px;
height: 40px;
overflow: hidden;
}
#box_content ul li span{
float: right;
color: #999;
}
</style>
</head>
<body>
<div>
<div>奥莱蕾西亚</div>
<div id="box_content">
<ul id="info_one">
<li><a href="#">1.让我掉下眼泪的</a><span>time</span></li>
<li><a href="#">2.不是昨夜的酒。</a><span>time</span></li>
<li><a href="#">3.让我依依不舍的,</a><span>time</span></li>
<li><a href="#">4.不止你的温柔。</a><span>time</span></li>
<li><a href="#">5.余路还要走多久,</a><span>time</span></li>
<li><a href="#">6.你攥着我的手。</a><span>time</span></li>
</ul>
<ul id="info_two"></ul>
</div>
</div>
<script type="text/javascript">
var content = document.getElementById('box_content');
var info = document.getElementById("info_one");
var info2 = document.getElementById("info_two");
content.scrollTop = 20;
alert(content.scrollTop);
var speed = 50;
content.scrollTop = 0;
info2.innerHTML = info.innerHTML;
function scrollUp(){
if(content.scrollTop >= info.scrollHeight) {
content.scrollTop = 0;
}else{
content.scrollTop ++;
}
}
var myScroll = setInterval("scrollUp()",speed);
content.onmouseover = function(){
clearInterval(myScroll);
}
content.onmouseout = function(){
myScroll = setInterval("scrollUp()",speed);
}
</script>
</body>
</html>