What is the difference between onclick and onclientclick in javascript?

What is the difference between onclick and onclientclick in javascript?

Both seem to be executing the functions on the client side.

<img id="myimage" onclick="changeImage()" onclientclick = "ChangeTitle()"
src="pic_bulboff.gif" width="100" height="180">

Please advise.

Who is Participating?
Miguel OzConnect With a Mentor Software EngineerCommented:
This event(Onclientclick ) does not exist for pure html img
The Onclientclick  is simply ignored as it is an invalid attribute. For all practical purposes you only need onclick to implement your JS click event.

Note: Onclientclick only exists for asp.net controls like buttons to allow you execute JS scripts /methods before running the event server code.
duttcomConnect With a Mentor Commented:
As outlined on this page - http://forums.asp.net/t/1249580.aspx

OnClick will work on server side , OnClientClick will execute on client side before control passed to server.
If the client side code returns TRUE then it will go to server.
Generally programmers use onclientclick to validate the controls like textbox,etc.
Dale BurrellConnect With a Mentor DirectorCommented:
AFAIK there is no onclientclick in javascript, it only exists in asp.net, where it gets rendered as onclick to the client i.e. in javascript?

What made you think it was a javascript event?
Ricky66Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.