点解点解
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js获取图片临时存储路径</title>
</head>
<body>
<div id="imgbox">
<img src="1.jpg" />
<img src="2.jpg" />
<img src="3.jpg" />
<img src="4.jpg" />
</div>
<script>
var boxImg=document.getElementById('imgbox').getElementsByTagName('img');
//获取到的的是一个类数组;
var imgData=[];
//存储图片数变量
for (var i= 0;i<boxImg.length;i++){
imgData.push(boxImg[i].getAttribute("src"));
}
console.log(imgData);
</script>
</body>
</html>