[Javascript] RE: RE: Invoke onclick event of one button from clicking a second button

Harry Love hlove at u.washington.edu
Thu Sep 12 22:46:23 CDT 2002


<snip>
Thanks Harry.  It worked for me too. Can you tell me why it worked when
we use the <input> tag and not the <button> tag.
 
George
</snip>

You're welcome.  I couldn't figure that out either.  According to the
standards (and I believe Cutter brought this up, too), the click()
method simulates a mouse click, but doesn't invoke the onclick event
handler in most elements.  However, in the HTMLInputElement
specification, the click() method simulates a mouse click for an <input>
whose type is "button," "checkbox," "radio," "reset," or "submit."  I
haven't read the entire specification, but it obviously invokes the
onclick event handler for another element.

However, why these two elements work in different ways is beyond my
knowledge.  Perhaps someone more experienced on the list could answer
that?

Regards,
Harry




More information about the Javascript mailing list