I have 5 images set up to fit within the header on my web page. I want each time the pages loads to randomly display 1 of the 5 images in the header... Is this complicated? Anyone got any ideas?
Thanks,
Tom
I have 5 images set up to fit within the header on my web page. I want each time the pages loads to randomly display 1 of the 5 images in the header... Is this complicated? Anyone got any ideas?
Thanks,
Tom
In Javascript? Not really.
Code:<img src="image1.png" name="headerImage"> <script type="text/javascript"> window.onload = function() { var images = ["image1.png", "image2.png", "image3.png"]; // Add more if you like document.images['headerImage'].src = images[Math.floor(Math.random() * images.length)]; }; </script>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Like mess.be?
What he said. ^ UP THERE ^
Bookmarks