為什么出不來動(dòng)畫效果
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>圖像</title>
</head>
<style>
*{margin:0;padding:0;font-size:14px;}
ul{list-style:none;height:50px;border-bottom:#F30 solid 5px;padding-left:50px;}
li{float:left;margin-top:20px;}
.on,a:hover{background:#F00;color:#FFF;}
a{text-decoration:none;display:block;width:120px;background:url(1.jpg);line-height:30px;height:30px;text-align:center;}
<script>
window.onload=function(){
? var aA=document.getElementsByTagName('a');
? for(var i=0;i<aA.length;i++)
? {
?? ?? aA[i].onmouseover=function(){
?? ??? ?? var This=this;
?? ??? ?? This.time=setInterval(function(){
?? ??? ?? This.style.width=This.offsetWidth+8+"px";
?? ??? ?? },30)
?? ?? }
?? ??? ?? if(This.offetWidth>=130){
?? ??? ???? clearInterval(This.time);
?? ??? ?? }?? ?
? }
}
</script>
</style>
<body>
<ul>
? <li><a class="on" href="#">名?? 字</a></li>
? <li><a href="#">畢業(yè)學(xué)校</a></li>
? <li><a href="#">性?? 別</a></li>
? <li><a href="#">出生年月</a></li>
? <li><a href="#">學(xué)?? 位</a></li>
</ul>
</body>
</html>
2016-08-12
同學(xué),你的<script>放到了<style>里了,當(dāng)然出不來了.把它放在body里或者h(yuǎn)ead里的style下面,不要放里面.
2016-08-12
2016-08-12
js代碼貌似不能寫在css代碼里邊