首页javascriptimgjQuery HTML Element - 如何获取图像的来源

jQuery HTML Element - 如何获取图像的来源

我们想知道如何获取图像的来源。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.6.js'></script>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
    console.log( $('img').attr('src') );
    console.log( $('img')[0].src );
});//]]>  
</script>
</head>
<body>
  <img src="http://www.w3cschool.cn/style/download.png" alt="Arnold">
</body>
</html>