|
| JAVASCRIPT ONCLICK EVENT
The javascript onclick event handler is used to trigger a script or action when a user clicks a mouse or a pointing device on an element. The onclick event calls the action from most elements.
Example:
<a href="#" onclick="alert('Jeepers! I\'ve been clicked');">Click this</a>
The above example will output Jeepers! I 've been clicked when you click on the link.
The onclick event can also call a function as follows:
<head>
<script type="text/javascript">
function clickme()
{
alert('Jeepers! I\'ve been clicked');
}
</script>
</head>
<body>
<a href="#" onclick="clickme();">Click this</a>
DEMO:
Click the link below to see the effect:
Click this
See also:
|
|