ColdEdge Posted February 19, 2009 Share Posted February 19, 2009 Hi, a while back i found a code which uses javascript as primary ground the problem now is that i lost it and have no idea where it is could any one help me?loads random image when page is refreshed from a list of set images... will be used on MyBB forum Link to comment Share on other sites More sharing options...
awitt Posted February 19, 2009 Share Posted February 19, 2009 Hi, a while back i found a code which uses javascript as primary ground the problem now is that i lost it and have no idea where it is could any one help me?loads random image when page is refreshed from a list of set images... will be used on MyBB forumi don't know offhand where it is, but i know i've seen code all over this forum that does pretty much exactly what you need it to do. i would advise that until someone else posts a better answer than me, look around the javascript forum and see what you can find. Link to comment Share on other sites More sharing options...
jeffman Posted February 19, 2009 Share Posted February 19, 2009 This should work. Post back if it doesn't: function load_image () { var images = []; images[0] = "image0.jpg"; images[1] = "image1.jpg"; images[2] = "image2.jpg"; // ADD AS MANY AS YOU LIKE var index = Math.floor(Math.random() * images.length); document.getElementById("my_image").src = images[index];} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.