+ 1

Img tag - need help

Hi all, how to define height and width in this code: document.write("<img src='" + imgArray[randomNumber] + "'/>"); ty

29th Nov 2019, 1:41 AM
Muaz
Muaz - avatar
4 Respostas
+ 9
You can use height and width attributes of img tag to specify height and width E.g. <img src="" height="" width=""> Or you can use CSS for specifying it, you can use class attribute to specify class. E.g. HTML : <img src="" class="myimg"> CSS : .myimg { height: 500px; width: 500px; }
29th Nov 2019, 2:04 AM
Raj Chhatrala
Raj Chhatrala - avatar
0
I appreciate your taking the time to answer my question, but how to combine that with this my code: js: var imgArray = ["bmw.jpeg","saab.jpg","maserati.jpg"]; var randomNumber = Math.floor(Math.random()*car.length); document.write("<img src='" + imgArray[randomNumber] + "'/>");
29th Nov 2019, 2:34 AM
Muaz
Muaz - avatar
0
in java script pu thi cod For example var imgArray = ["image1.jpg","image2.jpg","image3.jpg"]; for (var i = 3; i >= 0; i--) { document.write("<img src='" + imgArray[i] + "'/>"); }
30th Nov 2019, 1:04 AM
Ahmed Belkhodja
0
تويتوت
30th Nov 2019, 4:53 PM
ندوة الضاهر
ندوة الضاهر - avatar