I have a form for a registration page. The form contains an image that changes its src dependant on a situation. Within a script which activates upon submission of the form
Add an ID tag to your image (if it doesn't already have one), eg:
Then you can reference it as follows:
if (document.getElementById("imageId").src == "pictures/apic.png") { ... }
EDIT
Working example here: http://jsfiddle.net/2Wtkn/2/