 <p>Just looking at it, I'm pretty sure your code works. Well I know this does.</p> <pre><code>&lt;img id="pic" src="https://www.google.com.au/images/srpr/logo4w.png"/&gt; &lt;input type="button" value ="Yahoo" onclick="change('http://l.yimg.com/ao/i/mp/properties/frontpage/eclipse/img/y7-logo_default.v1.png')" /&gt; &lt;input type="button" value ="Google" onclick="change('https://www.google.com.au/images/srpr/logo4w.png')" /&gt; &lt;script&gt; function change(src){ document.getElementById('pic').src = src; } &lt;/script&gt; </code></pre>