Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Re: Invoke onclick event of one button from clicking a second button
- From: javascript@xxxxxxxxxx (Cutter (javascript list))
- Subject: [Javascript] Re: Invoke onclick event of one button from clicking a second button
- Date: Tue, 10 Sep 2002 08:36:34 -0400
From Javascript: The Definitive Guide, David Flanagan
The click() method of a form element simulates a mouseclick on the form
element but does not invoke the onclick event handler of the element
Cutter
George Tsang writes:
> Greetings,
>
> I have set up the following:
>
> <button id="abutton" onclick="alert('A clicked')">A</button>
> <br>
> <button id="bbutton" onclick="stuff = document.getElementById
> ('abutton'); stuff.click()">B</button>
>
> Result:
>
> By running this on IE5.5 and by clicking the 'B' button, I can invoke
> the alert message belonging to the onclick event of the 'A' button.
>
> However, this does not work in Netscape 6. The Netscape Javascript
> Console posted the error: "stuff.click is not a function".
>
> I changed the button tag attributes of the 'B' button to:
>
> <button id="bbutton" onclick="stuff = document.getElementsByTagName
> ('button'); stuff[0].click()">B</button>
>
> Result:
>
> IE5.5 works. Netscape 6 still does not work. The Netscape Javascript
> Console posted the error: "stuff[0].click is not a function".
>
> Is there anything else one can do to resolve this problem.
>
> Thanks.
- References:
- Prev by Date: [Javascript] Invoke onclick event of one button from clicking a second button
- Next by Date: [Javascript] RE: Invoke onclick event of one button from clicking a second button
- Previous by thread: [Javascript] Invoke onclick event of one button from clicking a second button
- Next by thread: [Javascript] Invoke onclick event of one button from clicking a second button
- Index(es):