title: JS Image onClick src problems
body: <p>First post here.</p>
  
  <p>So I am pretty good with my HTML and PHP, but fail at JS.
  I am trying to make a simple toggle using images.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;img src="clear.png" id="imgClickAndChange" onclick="changeImage()"&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>&lt;script language="javascript"&gt;
  function changeImage() {
  
      if (document.getElementById("imgClickAndChange").src == "clear.jpg") 
      {
          document.getElementById("imgClickAndChange").src = "full.jpg";
      }
      else 
      {
          document.getElementById("imgClickAndChange").src = "clear.jpg";
      }
  }
  </code></pre>
  
  <p></p>
  
  <p>This code does not work as the script is receiving the src as its full path and not just "clear.jpg".
  Not a clue how to get around this.
  I've tried using substr, that didn't work.
  I wouldn't mind using the full path but the location could be relative on my server.</p>
  
  <p>Rhys</p>