Home >Web Front-end >JS Tutorial >js method to find all image addresses in a certain element_jquery

js method to find all image addresses in a certain element_jquery

WBOY
WBOYOriginal
2016-05-16 17:03:261556browse

Copy code The code is as follows:

function findImg() {
var charImg = document .all("chartImg").getElementsByTagName("img");
var imgURLs = "";
for (var i = 0; i < charImg.length; i ) {
var imgPath = getImgPath(charImg[i].src);
var imgNames=getImgNames(imgPath);
if (imgNames!= "vt2.png") {
imgURLs = imgNames; //If using document.getElementsByTagName ("img")[i].src; Every time an image address is taken, all images will be searched. This is relatively inefficient. It is better to store it in imgs!
}
}
alert( imgURLs);

}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn