I am trying to use Javascript to swap an image, so far I can get it from A to B, but not back.
Here is what I\'m using to create one swap:
window.document.pic.src='pic1.png'
assigns pic1.png
to the left hand side. It does NOT compare.
Though not directly relevant, try not to access elements by their name globally. Use their id
.
Your javascript should not be inside the onclick. It should be inside a javasctipt function
Combined:
The img tag:
The javascript