Here is JS
var images = [
"",
"01.jpg",
"02.jpg",
"03.jpg"];
function randImg() {
var size = images.length
var x = Math.floor(size * Math.random())
document.getElementById('image').src = images[x];
}
randImg();
var imagesr = [
"",
"01b.jpg",
"02b.jpg",
"03b.jpg"];
function randImgr() {
var sizer = imagesr.length
var y = Math.floor(sizer * Math.random())
document.getElementById('imager').src = imagesr[y];
}
randImgr();
HTML
<body onload="randImg()" onload="randImg()">
on the page just can show one image. the error message is "Uncaught TypeError: Cannot set property 'src' of null"
If i delete one part of JS, it works fine.
I don't know too much about JS, not sure what's wrong.