Random Images two locations same set
<p>So basically what I am looking for is how to have a random image javascript code but the images are in two different divs but I would like the random images to come from the same array.</p>

<p>I plan to take a JS class this summer so I don't have to ask anymore because I feel like this should be simple...</p>

<p>Currently I am just using the code from javascript kit in two different locations:</p>

<pre><code>&lt;script language="JavaScript"&gt;
&lt;!--

/*
Random Image Script- By JavaScript Kit (http://www.javascriptkit.com) 
Over 400+ free JavaScripts here!
Keep this notice intact please
*/

function random_imglink(){
    var myimages=new Array()
    //specify random images below. You can have as many as you wish
    myimages[1]="image1.gif"
    myimages[2]="image2.gif"
    myimages[3]="image3.gif"
    myimages[4]="image4.gif"
    myimages[5]="image5.gif"
    myimages[6]="image6.gif"

    var ry=Math.floor(Math.random()*myimages.length)
    if (ry==0)ry=1
    document.write('&lt;img src="'+myimages[ry]+'" border=0&gt;')
}
random_imglink()
//--&gt;
&lt;/script&gt;
</code></pre>

<p>but what I hope to achieve is:</p>

<pre><code>&lt;script language="JavaScript"&gt;
&lt;!--

/*
Random Image Script- By JavaScript Kit (http://www.javascriptkit.com) 
Over 400+ free JavaScripts here!
Keep this notice intact please
*/

function random_imglink(){
    var myimages=new Array()
    //specify random images below. You can have as many as you wish
    myimages[1]="image1.gif"
    myimages2[1]="image1a.gif"
    myimages[2]="image2.gif"
    myimages2[2]="image2a.gif"

    var ry=Math.floor(Math.random()*myimages.length)
    if (ry==0) ry=1
    document.write('&lt;img src="'+myimages[ry]+'" border=0&gt;')
}
random_imglink()
//--&gt;
&lt;/script&gt;
</code></pre>

<p>RENDERED CODE WITHIN DIVS</p>

<pre><code>&lt;div class="one"&gt;&lt;img src="img1.gif"&gt;&lt;/div&gt;
&lt;div class="two"&gt;&lt;img src="img1a.gif"&gt;&lt;/div&gt;
</code></pre>

<p>REFRESHED</p>

<pre><code>&lt;div class="one"&gt;&lt;img src="img2.gif"&gt;&lt;/div&gt;
&lt;div class="two"&gt;&lt;img src="img2a.gif"&gt;&lt;/div&gt;
</code></pre>
