0
<script type = "text/javascript">
function functionCall(){
...
}
</script>

<input type="image" src="uri1.png" onclick="this.src='uri2.png'"/>

this works for changing the image for onclick event

<input type="image" src="uri1.png" onclick="functionCall"/>

this works for calling a function

how do i make both function call and image change to occur for same onclick.

2
  • But why are you doing both things separately. Just change the img source in that function call!!! Commented Sep 18, 2012 at 10:46
  • Here is a related answer! stackoverflow.com/questions/2414500/… Commented Sep 18, 2012 at 10:48

1 Answer 1

1

You can add multiple actions by separating with ;

onclick="this.src='uri2.png'; functionCall()"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.