javascript - random picture script for new app -
i creating app through appmaker , want random picture appear when clicks icon. found script online. entered script in (where accept html on screen) , doesn't seem run when test it. created several test pictures , uploaded them online site , ran script. appreciated. script follows:
<script type="text/javascript"> var total_images = 2; var random_number = math.floor((math.random(2)*total_images)); var random_img = new array(3); random_img[0] = '<a href="http://mymoonspirit.com/images/tarot1.jpg"><img src="images/tarot1.jpg"></a>';; random_img[1] = '<a href="http://mymoonspirit.com/images/tarot2.jpg"><img src="images/tarot2.jpg"></a>';; document.write(random_img[random_number]); </script>`
i've looked around , looks best solution;
var image-number = math.floor(math.random() * random_img.length); var image = random_img[image-number];
Comments
Post a Comment