日期:2014-05-16 浏览次数:20675 次
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test1</title>
<script src="Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
window.onload = function () {
//DOM方法
var imgs = document.getElementById("J_UlThumb").getElementsByTagName("img");
for (var i = 0; i < imgs.length; i++) {
alert(imgs[i].src);
}
//jquery方法
$("#J_UlThumb").find("img").each(function () {
alert($(this).attr("src"));
});
}
</script>
</head>
<body>
<div id="J_UlThumb">
<img id="Img1" src="img1.jpg" />
<img id="Img2" src="img2.jpg" />
</div>
</body>
</html>