为什么这个一直提示我Uncaught TypeError: Cannot read property 'innerHTML' of null ?是哪里错了 呢?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>fvv</title>
<style type="text/css">
#moocBox{
margin:0 auto;
width: 200px;
height:200px;
background-color: orange;
overflow: hidden;
}
ul{
list-style-type: decimal;
color:#fff;
}
a{
text-decoration:none;
line-height: 30px;
font-size: 19px;
color:#fff;
font-weight: bold;
}
</style>
<script type="text/javascript">
var area=document.getElementById("moocBox");
var con1=document.getElementById("con1");
var con2=document.getElementById("con2");
con2.innerHTML=con1.innerHTML;
function scrollUp(){
if(area.scrollTop>=con1.offsetHeight){
area.scrollTop=0;
}else{
area.scrollTop++;
}
}
var time=50;
var myscroll=setInterval("scrollUp()",time);
area.onmouseover=function(){
clearInterval(myscroll);
}
area.onmouseout=function(){
setInterval("scrollUp()",time);
}
</script>
</head>
<body>
<div id="moocBox">
<ul id="con1">
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
<li><a href="#">bfjhbhebf</a></li>
</ul>
<ul id="con2"></ul>
</div>
</body>
</html>