- 1.做对自己有意义的事2016-05-28
- 2.关于CSS选择器继承2016-05-30
- 3.自己动手,丰衣足食2016-06-01
- 4.论inline-block2016-06-02
- 5.更多正在编写中……2016-06-02
下面的代码,js是放在body的底部的,我想放在的下面,也就是body前面运行,但是显示结果是失败的,要怎么修改,才能放在顶部,或者放在单独的js文件中,谢谢!
调试*{margin:0; padding:0; color:black;}
ul{list-style:none;}
a{text-decoration:none;}
a:hover{color:orange;}
#articleList{width:400px; border:5px solid gray;}
#articleTitle{height:50px; line-height:50px; font-size:24px; text-align:center; border-bottom:1px solid gray;}
#articleContent{width:350px; height:125px; margin:10px 25px; overflow:hidden;}
#articleContent ul li a{width:200px; height:25px; line-height:25px; display:inline-block; padding-left:15px; overflow:hidden;}
#articleContent ul li span{float:right; color:gray;}
最近更新文章
var area = document.getElementById("articleContent");
var newList = document.getElementById("newList");
var newListTemp = document.getElementById("newListTemp");
var speed = 50;
area.scrollTop = 0;
newListTemp.innerHTML = newList.innerHTML;
function scrollUp(){
if(area.scrollTop >= newList.scrollHeight){
area.scrollTop = 0;
}
else{
area.scrollTop ++;
}
}
var myScroll = setInterval("scrollUp()", speed);
area.onmouseover = function(){
clearInterval(myScroll);
}
area.onmouseout = function(){
myScroll = setInterval("scrollUp()", speed);
}