Hi i have this javascript
<script> function showSurpriseImage() { var x = document.createElement("IMG"); x.setAttribute("id", "boxmm"); x.setAttribute("class", "boxmm"); x.setAttribute("src", "images/mese.gif"); x.setAttribute("onclick", "showSurpriseImage2();PlayedSound2();"); document.getElementById("surprise").appendChild(x); } </script> <script> function showSurpriseImage2() { var x = document.getElementById("boxmm"); x.setAttribute("src", "images/source.gif"); x.setAttribute("onclick", "showSurpriseImage3();PlayedSound2()"); x.setAttribute("class", "boxml"); x.setAttribute("id", "boxml"); } </script> <script> function showSurpriseImage3() { var x = document.getElementById("boxml"); x.setAttribute("src", "images/source.gif"); x.setAttribute("onclick", "showSurpriseImage3();PlayedSound2()"); x.setAttribute("class", "boxml"); x.setAttribute("id", "boxml"); } </script> Its changing GIF after clicking on that img, but when i press button on img tag with onclick function showSurpriseImage2() { it wont play source.gif but the first GIF again and then it will play source.gif. I cant find the problem. Thanks
HTML This is the button that spawns the first gif (showSurpriseImage)
<a class="boxmb" href="#section2"><img class="boxmb" id="boxmb" id="togglee" src="images/box1.png" id="image1" onclick="showButton();diffImage(this);showSurpriseImage();PlaySound();" > </a> The site is not responsive yet so you wont see it properly http://americafulfillment.com/#section2