Javascript placeholders
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6919086/javascript-placeholders">Javascript placeholders</a>  </p>
</blockquote>



<p>Erm.. i really new to javascript and struggling big with it. The code i have is below. It's easier to explain with more code. So basically want to show each image in each placeholder but in the order i click them in. So if i click img 3 this will go to placeholder 1 then the next one i click will go to placeholder 2 if that makes sense. (this tricky bit is once one option has been chosen i want to not allow that option again. either with an error message saying already used or disappear from list)                         </p>

<pre><code>    &lt;script type="text/javascript" language="javascript"&gt;
function showPic (whichpic) { 
    if (document.getElementById) { 
        document.getElementById('placeholder1').src = whichpic.href;
        document.getElementById('placeholder2').src = whichpic.href;
        document.getElementById('placeholder3').src = whichpic.href;
        if (whichpic.title) { 
            document.getElementById('desc').childNodes[0].nodeValue = whichpic.title; 
        } else { 
            document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue; 
        } 
        return false; 
    } else { 
        return true; 
    } 
}
&lt;/script&gt;

&lt;div style="border: 1px solid #999; padding: 1em; margin: 0 0 15px 0;"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a onclick="return showPic(this)" href="images/img1.jpg" title="img 1"&gt;img 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick="return showPic(this)" href="images/img2.jpg" title="img 2"&gt;img 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick="return showPic(this)" href="images/img3.jpg" title="img 3"&gt;img 3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p id="desc"&gt;Choose an image to begin&lt;/p&gt;
&lt;img id="placeholder1" src="images/blank.gif" alt="" /&gt;
&lt;img id="placeholder2" src="images/blank.gif" alt="" /&gt;
&lt;img id="placeholder3" src="images/blank.gif" alt="" /&gt;
&lt;/div&gt;
</code></pre>
