Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <script>
- function changeImg() {
- if (document.getElementById("cycle").src == "fox.jpg")
- {
- document.getElementById("cycle").src = "hawk.jpg";
- }
- else
- {
- document.getElementById("cycle").src = "ant.jpg";
- }
- }
- </script>
- <button onclick = "changeImg()">change image</button>
- <img id ="cycle" src ="fox.jpg"/>
- </body>
- </html>
Add Comment
Please, Sign In to add comment