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
Release: 2016-05-16 17:03:26
Original
1560 people have browsed it

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);

}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template