Html Image Button Onclick Javascript Function. Thanks a lot taj but we ve got a requirement that we should use only asp image buttons. The onclick event occurs when the user clicks on some element on web page most when button is clicked.

Thatraja 22 jul 11 0 22am ok then use asp image button remove the attribute runat server. Get the button and when the user clicks on it execute myfunction document getelementbyid mybtn onclick function myfunction. The javascript onclick function is designed to execute code when users interact with the html elements.
Thanks a lot taj but we ve got a requirement that we should use only asp image buttons.
The javascript onclick event is one of the most frequently utilized event types. Now add function in the button tag which is name imagefun with onclick event. The onclick event occurs when the user clicks on some element on web page most when button is clicked. That is why it is mostly used with the javascript function.