我也是醉了,找了半天,找不出问题,就是实现不了,要砸电脑的节奏,大神有空给我解答下,哎--
<!DOCTYPE html>
<html>
<head>
<title>创建一个jquery插件</title>
<script src="http://www.imooc.com/data/jquery-1.8.2.min.js" type="text/javascript"></script>
</head>
<body>
<div>
<h1>创建一个JQuery插件</h1>
<ul id="ul">
<li>Test1</li>
<li>Test2</li>
</ul>
</div>
<script type="text/javascript">
(function(){
$.extend({
"change_color":function(li_col){
var def_over = "#ccc";
var def_out = "#fff";
def_over =(li_col == undefined) ? def_over : li_col;
$(this).find("li").each(function(){
$(this).mouseover(function(){
$(this).css("background-color",def_over);
}).mouseout(function(){
$(this).css("background-color",def_out);
});
});
}
});
})(jQuery);
$(function(){
$("#ul").change_color();
});
</script>
</body>
</html>