Update 2 exact same images source using javascript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5958617/update-2-exact-same-images-source-using-javascript">Update 2 exact same images source using javascript</a>  </p>
</blockquote>



<p>I using PHP captcha called Cryptographer captchan.fr site</p>

<p>I need to use 2 captcha on same page but i have problem they do get generated but when i click refresh only first one refreshes, refresh code looks like this.</p>

<pre><code>document.images.captcha.src='cryptographp.html?cfg=0&amp;&amp;'+Math.round(Math.random(0)*1000)+1;
</code></pre>

<p>I tried this code but it only works for first one anyway</p>

<pre><code>document.getElementById('captcha').src='cryptographp.html?cfg=0&amp;&amp;'+Math.round(Math.random(0)*1000)+1;
</code></pre>

<p>Now i wanted to do something like this i added name="captcha" to image but this does not work for some reason can someone help me fix it?</p>

<p><code>document.getElementsByName('captcha').src='cryptographp.html?cfg=0&amp;&amp;+Math.round(Math.random(0)*1000)+1;</code></p>

<p>I also have jquerry attached to page if thats easier.</p>

<p>i tried to remove id and use class but still this does nothing</p>

<pre><code>$('.captcha').src='cryptographp.html?cfg=0&amp;&amp;'+Math.round(Math.random(0)*1000)+1;
</code></pre>

<p>because saying undefined reference.</p>
