ksk226
06-09-2010, 07:27 PM
This is my code below. I LOVE everything about it, border and all.
However, this only randomly changes when I reload the page.
Is there a way I can make it so that the images keep rotating when I'm on the page instead of it randomly changing everytime I reload?
I would like to keep the border and size and all.
I REALLY NEED HELP!!!! THANK YOU SO MUCH IN ADVANCE!
<script type="text/javascript">
/*********Edit values here for your pictures*******************/
var
pic1='https://store-a32dc.mybigcommerce.com/product_images/uploaded_images/MOMSHOPPING2.gif',
pic2='https://store-a32dc.mybigcommerce.com/product_images/uploaded_images/RRR.gif',
pic3='https://store-a32dc.mybigcommerce.com/product_images/uploaded_images/2photos.jpg';
/***************End of Edit*********************************/
var rangPics=[pic1,pic2,pic3]; // Add all the picture variables in this array.
window.onload=function() { rangRandom=Math.floor(Math.random()*rangPics.length);
document.getElementById('show').innerHTML='<img src="'+rangPics[rangRandom]+'" alt="myimage" style="width:950px;height:450px;">';}</script>
<div id="show" style="text-align:center;width:950px;border:3px double #222;padding:10px;"></div>
However, this only randomly changes when I reload the page.
Is there a way I can make it so that the images keep rotating when I'm on the page instead of it randomly changing everytime I reload?
I would like to keep the border and size and all.
I REALLY NEED HELP!!!! THANK YOU SO MUCH IN ADVANCE!
<script type="text/javascript">
/*********Edit values here for your pictures*******************/
var
pic1='https://store-a32dc.mybigcommerce.com/product_images/uploaded_images/MOMSHOPPING2.gif',
pic2='https://store-a32dc.mybigcommerce.com/product_images/uploaded_images/RRR.gif',
pic3='https://store-a32dc.mybigcommerce.com/product_images/uploaded_images/2photos.jpg';
/***************End of Edit*********************************/
var rangPics=[pic1,pic2,pic3]; // Add all the picture variables in this array.
window.onload=function() { rangRandom=Math.floor(Math.random()*rangPics.length);
document.getElementById('show').innerHTML='<img src="'+rangPics[rangRandom]+'" alt="myimage" style="width:950px;height:450px;">';}</script>
<div id="show" style="text-align:center;width:950px;border:3px double #222;padding:10px;"></div>