event occurs when the mouse button is pressed.
HTML tags that support the event:
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, < Button>,
<caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>,
<form>, <li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span> , <strong>,
<sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, < Thead>,
<tr>, <tt>, <ul>, <var>
JavaScript objects that support the event:
button, document, link
Example:
Displays the label name of the clicked element:
<script type= "Text/javascript" >
function Alertelement (e)
{
var Targ;
if (!e) {
var e = window.event;
}
if (e.target) {
Targ = E.target;
}
else if (e.srcelement) {
Targ = e.srcelement;
}
if (Targ.nodetype = = 3) {//defeat Safari Bug
Targ = Targ.parentnode;
}
var tname;
Tname=targ.tagname;
Alert ("The tag element you clicked on is:" + tname);
}
</script>
<body onmousedown= "Alertelement (event)" >
<span>span Elements </span>
<p>p Elements </p>
<div>div Elements </div>
</body>
HTML Dom Event Object onmousedown Events