Basically, I have a page where 2 random images get generated using this script:
<script type="text/javascript">
<!--
var imlocation = "images/";
var currentdate = 0;
var image_number = 0;
function ImageArray (n) {
this.length = n;
for (var i =1; i <= n; i++) {
this[i] = ' '
}
}
image = new ImageArray(3)
image[0] = 'image1.gif'
image[1] = 'image2.gif'
image[2] = 'image3.gif'
var rand = 60/image.length
function randomimage() {
currentdate = new Date()
image_number = currentdate.getSeconds()
image_number = Math.floor(image_number/rand)
return(image[image_number])
}
document.write("<img src='" + imlocation + randomimage()+ "'>");
//-->
</script>
and then repeated again using different variables so both images are random. I need the sizes of both images to be the same. CSS doesn’t seem to be doing the trick using .img and specifying the height and width. Is there another way I could do it?
With CSS, you indicate named classes with a starting period (i.e.
.mycssclass { }), whereas with named elements you just specify the element name (i.e.img { }). So this could be why your styles aren’t being applied.