+ 1
Img tag - need help
Hi all, how to define height and width in this code: document.write("<img src='" + imgArray[randomNumber] + "'/>"); ty
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;
}
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] + "'/>");
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] + "'/>");
}
0
تويتوت