求问代码为什么不能实现?
<!DOCTYPE html>
<html>
<head>
<title>使用$.extend()扩展工具函数</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<style>
*{
margin:0;padding:0;
}
div{
width:300px;
margin:10px auto;
padding:5px;
}
span{
margin:10px;
}
li{
list-style:none;
margin:10px auto;
width:100px;
border:1px solid;
}
</style>
<script>
$(function () {
$("li").each(function(index){
var a = $("#a").val();
$("li:eq(index)").hover(
function(){
$(this).css("background-color", "a");
},
function(){
$(this).css("background-color", "#fff");
})
})
});
</script>
</head>
<body>
<div>
<span>输入颜色:</span><input type="text" id="a" >
<ul>
<li>1</li>
<li>22</li>
<li>333</li>
<li>4444</li>
<li>55555</li>
</ul>
<div id="content"></div>
</div>
</body>
</html>求问哪里错了?