The onclick event activates when an element is clicked with the mouse. The event can be specified as a JavaScript expression or the name of a JavaScript function.
If an expression is used, the JavaScript keyword this refers to the element that was clicked.
If the name of a function is used, the function will receive 2 parameters when called:
- The browser event object
- A reference to the element that was clicked
Examples:
The following can be placed on an icon which will toggle a Grid's expanded vs. collapsed mode.
onclick: getObj("Grid1").toggle();
The following can be placed on a hyperlink to make it go to a specific URL in a new browser window.
onclick: window.open("http://www.google.com");
Note: By default, a button's "onclick" event will take precedence over the "response" property. If both are defined, the "onclick" event will fire and control will not return to the server.