PDA

View Full Version : How to call a event of a button thro script


anandraj
03-10-2003, 10:02 AM
Hi All,
I have a HTML Page when the user clicks on the button "B" I want to call a click event of Button "A" Is it possible? Any Idea to implement this.

Thanks and Regards
Anandraj.A.

Roy Sinclair
03-10-2003, 05:28 PM
Assuming "a" and "b" are in the same form something like this should do the trick:


<input name="b" onclick="this.form.a.onclick()" ...>

cheesebagpipe
03-10-2003, 09:52 PM
Don't mean to be picky here - but you can't 'call a click event'. Functions are called, not events. Button objects have a .click() method which, naturally, is callable:

<input name="B".......... onclick="A.click()">

This generates a click event on the object. You can also call event handler properties directly, as illustrated above...

Roy Sinclair
03-10-2003, 10:24 PM
Originally posted by cheesebagpipe
Don't mean to be picky here - but you can't 'call a click event'. Functions are called, not events. Button objects have a .click() method which, naturally, is callable:

<input name="B".......... onclick="A.click()">

This generates a click event on the object. You can also call event handler properties directly, as illustrated above...

That's correct, the (untested) code snippet I wrote actually calls the function which is attached to the onclick event for "a".

cheesebagpipe
03-10-2003, 10:26 PM
Hey Roy....:Das illustrated above...

anandraj
03-11-2003, 05:25 AM
Thanks a lot to everyone.

Thanks and Regards
Anandraj.A.