这段代码,为何不支持IE8/IE9/IE10?

<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    alert("Image width: " + $("img").attr("src"));
  });
});
</script>
</head>
<body>

<img src="u=3483771628,3419607408&fm=21&gp=0.jpg" alt="Pulpit Rock" width="284" height="213">
<br>
<button>Return the width of the image</button>

</body>
</html>
阅读 5.2k
2 个回答

学会用F12
IE下 报错, 不识别 $

可能百度的jquery版本的问题, 换个版本的看看

实测,可以运行。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进