希望大家多看看的例子我研究好久的东西
要求5字符
2015-07-06
你那狗啃的代码,我实在看不懂了。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>挑战题</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<style>
ul {width:70px;overflow: hidden;}
ul li {width:70px;height:30px;text-align:center;line-height:30px;display: block;}
</style>
</head>
<body>
<ul>
<li>好</li>
<li>呀</li>
<li>好</li>
<li>想</li>
<li>你</li>
<li>!</li>
</ul>
<script>
$(document).ready(function(){
function randomColor() {
return '#'+parseInt((Math.random()*0x1000000)).toString(16);
}
$.extend({"randomBGC" : function(element){
element.mouseover(function(){
$(this).css({"color":randomColor(),"background-color":randomColor()});
});
element.mouseout(function(){
$(this).css({"color":"#000","background-color":"rgba(0,0,0,0)"});
});
}
});
$.randomBGC($("li"));
});
</script>
</body>
</html>举报