使用Javascript自动调整交换图像

时间:2013-11-18 15:13:35

标签: javascript dom

//The line below gets the tag type, in this instance, it's the image tag <img>
var imgs = document.getElementsByTagName("img");
//This is where the magic happens. We start by setting up the concept
for (var i = 0, l = imgs.length; i < l; i++) {
//This is where we replace imgs (the variable that gets the image tag), gets the requirements with     "[i]", and replaces the images met by the requirements with the src (source link)
imgs[i].src = "http://3.bp.blogspot.com/-KL7d7LdSANg/Tm5VLQf9k4I/AAAAAAAAACo/cSV52JoD7vk/s1600/cat-wallpaper-34-713472.jpg";
}

我正在寻找自动调整,然后在加载页面后自动裁剪新图像。猫填充图像,但它扼杀了它。 Javascript是我假设我将使用的。

0 个答案:

没有答案