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

jquery img的click事件不起作用
RT

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.lazyload.js" type="text/javascript"></script>
<script type="text/javascript">

/*$(".small").hover(function(){
  $("http://v.pp.cn/static/img/index_big.png").lazyload(); 
},function(){});*/

/*$(".small").click(function(){
  $(this).attr('src', "http://v.pp.cn/static/img/index_big.png");
});*/

$("img.small").bind("click",function(){
  alert(1);
  $(this).attr('src', "http://v.pp.cn/static/img/index_big.png");
});
</script>
<img src="http://testv.pp.cc/static/img/no_photos.jpg"> <br>
<img src="http://testv.pp.cc/static/img/d.jpg"> <br>
<img class="small" id="small" src="http://testv.pp.cc/static/img/s.jpg"> <br>


------解决方案--------------------
$(document).ready(function() {

$("img.small").bind("click",function(){
alert(1);
$(this).attr('src', "http://v.pp.cn/static/img/index_big.png");
});
});