摘要:<!DOCTYPE html><html><head> <title>获取随机色</title> <meta charset="utf-8"> <script type="text/javascript" src="http://libs.baidu.com/jquery
<!DOCTYPE html>
<html>
<head>
<title>获取随机色</title>
<meta charset="utf-8">
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<style type="text/css">
a{
float: left;/*左浮动*/
display: block;
margin: 50px; /*外面距*/
width: 100px;
line-height: 100px;
text-align: center;/*居中*/
height: 100px;
color: red;
border-radius: 50px;/*圆角*/
text-decoration: none;
}
</style>
<script type="text/javascript">
function aa(tag){
var len=document.getElenentsByTagName(tag).length
for(var i=0;i<len;i++){
document,getElementsByTagName(tag)[i].style.backgroundColor='rgb('+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','Math.floor(Math.random()*256)+')'
} //获取随机色
}
$(document).readey(function(){
aa('a')
$('a').mouseover(function(){
$bg=$(this).css('backgroundColor')
$(this).css('box-shadow','0px 0px 10px'+$bg)
$(this).css('border-radius' '20px')
})//鼠标移入效果
$('a').mouseleave(function(){
$bg=$(this).css('backgroundColor')
$(this).css('box-shadow','none')
$(this).css('border-radius' '50px')
})//鼠标移出效果
})
</script>
</head>
<body>
<a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
</body>
</html>
批改老师:灭绝师太批改时间:2018-11-20 17:12:09
老师总结:for循环里面的(tag)[i],你写(tat);
代码不熟练,目前属于没理解代码,照着老师的抄抄,还抄错了!错了还找不到为什么!
作业我需要你重新提交,并且以后的作业代码必须备注每一条语句是做什么的!