Javascript random image on click button

后端 未结 7 1579
清歌不尽
清歌不尽 2020-12-21 19:10

I\'ve been following some tutorials on how to randomize an image by setting up an array in Javascript. It\'s not working - the image itself is not appearing, not even any e

7条回答
  •  执笔经年
    2020-12-21 20:03

    You forgot a ) in your if statement and on your document.write you missed ' and closing the tag. Check here:

    if (rnd == 0) {
            rnd = 1;
        }
    
    document.write('');
    

提交回复
热议问题