簡體   English   中英

如何在js中設置圖像對象的高度和寬度

[英]How to set height and width of an image object in js

我有這個圖像對象數組,如果可能的話,我想設置高度和寬度,因為我將大量圖像放在一張桌子中,並且希望它們都具有相同的大小。 有任何想法嗎?

function myFunction(){   
    var imagelist = [{"image":"image3.jpg"}];
}

 function resizeImg(img, height, width) { img.height = height; img.width = width; } 
 <img src="http://www.lawctopus.com/wp-content/uploads/2015/10/new-google-logo.jpg" onload="resizeImg(this, 200, 100);"> 

在這里,我創建了一個函數,通過它可以設置圖像的heightwidth

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM