日期:2014-05-16  浏览次数:20323 次

简单jquery切换图片
请指教哪里写错了
<script type="text/javascript">
$(document).ready(function(){
$("#001").mouseenter(function(){
// alert(11);
// $(this).src="img/cry.gif";
$(this).css("src","url(img/cry.gif)");
});
});
</script>
</head>

<body>
<img id="001" src="img/smile.gif"/>
</body>
</html>

------解决方案--------------------
1.id值不规范,应该以字母或下划线开头
2.
$(this).attr("src","img/cry.gif");