title: onclick="function()" not working but href="javascript: function()" works fine?
body: <p>I have written a function which quite simply changes the style attributes of an image when clicked. </p>
  
  <pre><code>    document.getElementById("normal" + current).setAttribute('style', 'display: block;');
  </code></pre>
  
  <p>current is a parameter for the function. e.g. changeImage(10)
  and the element image which we want to change the style for has a resultant id of "normal10".</p>
  
  <p>To make it display, basically as it's set as display: none obviously to begin with, we need to change that to block.</p>
  
  <p>So, I have two instances where I call the method changeImage(current).</p>
  
  <p>One which is:</p>
  
  <pre><code>    &lt;a href="#" onclick="changeImage(10);"&gt;&lt;img src="xyz"&gt;&lt;/img&gt;&lt;/a&gt;
  </code></pre>
  
  <p>and another which is:</p>
  
  <pre><code>    &lt;a href="javascript: changeImage(10);"&gt;&lt;img src="xyz"&gt;&lt;/img&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Both of these function correctly on Chrome &amp; Opera, the display attribute is changed both times.</p>
  
  <p>However on any other browser such as IE or Firefox, the display attribute only seems to get changed where we have </p>
  
  <pre><code>    &lt;a href="javascript..."&gt; 
  </code></pre>
  
  <p>and not where the method is called upon via the onclick.
  I tried to change to:</p>
  
  <pre><code>    document.getElementById("normal" + current).style.display="block";
  </code></pre>
  
  <p>Unfortunately to no avail.</p>
  
  <p>I don't think there is an issue with the javascript itself. Since the function executes fine when called within the href.</p>
  
  <p>Does anybody have any ideas?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT:
  Done with jQuery, code executes but the style of the image still doesn't change. Works in Chrome &amp; Opera still but not in firefox &amp; IE.</p>
  
  <p>I gave the image that is clicked to execute the function an id of "img".</p>
  
  <pre><code>    &lt;img id="img" src="..."&gt;&lt;/img&gt;
  </code></pre>
  
  <p>and the code to execute the function is placed in the following tags (in document ready function):</p>
  
  <pre><code>    $('#img').click(function(){}
  </code></pre>
  
  <p>Code is executed, but style is only changed from none to block on specific browsers.</p>