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

George Tsang tsang at interlog.com
Mon Sep 9 18:58:36 CDT 2002


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20020909/581bc82d/attachment.htm>


More information about the Javascript mailing list