Occurs when the user clicks a button or check box. Available only in client script.
Syntax
object_onclick
Parameters
object
A Button or Checkbox script object.
Remarks
For the Button object, the event occurs when the user uses the mouse or the spacebar to press the button. The event occurs when the button is pressed and then released.
Note For buttons created by the RecordsetNavbar object, use the onfirstclick, onlastclick, onnextclick, and onpreviousclick events.
Examples
The following is an example of how to trap the button click event for a delete button. The script prompts the user to confirm the deletion before proceeding.
<SCRIPT LANGUAGE="Javascript">
function thisPage_onbeforeserverevent( obj, event ){
if (obj=="btnDelete"){
if(event=="onclick"){
if (confirm("Are you sure you want to Delete?")){
alert("Deleted per your request");
}
else {
alert("Delete cancelled");
thisPage.cancelEvent = true;
}
}
}
}
</SCRIPT>
This following sample script is a server-side onclick event handler that will toggle the checked state of a check box.
Sub mybutton_onclick()
If checkbox1.getChecked() then
checkbox1.setChecked(0)
Else
checkbox1.setChecked(1)
End if
End Sub