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

这段代码,为何不支持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>

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

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


实测,可以运行。

【热门文章】
【热门文章】