|
|
 |
 |
 |
 |
Javascript / Client Side Development
|
 |
 |
 |
 |
 |
 |
 |
 |
Multiple onclick attributes
How do you apply 2 onclick events to a check box. I googled this and found multiple ways of doing it, but they dont work. Maybe i was not using the correct syntax, but i cant figure it out. these are the 2 i need to work for one check box: "toggle(Monday1,true,Sunday1,true)" "addUp(99, 'Monday1')" thanks for your help Josh
macsaregr@gmail.com said the following on 3/20/2007 6:41 PM: > How do you apply 2 onclick events to a check box. I googled this and > found multiple ways of doing it, but they dont work. Maybe i was not > using the correct syntax, but i cant figure it out. > these are the 2 i need to work for one check box: > "toggle(Monday1,true,Sunday1,true)" > "addUp(99, 'Monday1')"
Are Monday1 and Sunday1 variable names? onclick="toggle(Monday1,true,Sunday1,true);addUp(99,'Monday1')" Or, reverse them if you need the order reversed in execution: onclick="addUp(99,'Monday1');toggle(Monday1,true,Sunday1,true)" -- Randy Chance Favors The Prepared Mind comp.lang.javascript FAQ - http://jibbering.com/faq/index.html Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
On Mar 20, 7:57 pm, Randy Webb <HikksNotAtH@aol.com> wrote:
> macsaregr @gmail.com said the following on 3/20/2007 6:41 PM: > > How do you apply 2 onclick events to a check box. I googled this and > > found multiple ways of doing it, but they dont work. Maybe i was not > > using the correct syntax, but i cant figure it out. > > these are the 2 i need to work for one check box: > > "toggle(Monday1,true,Sunday1,true)" > > "addUp(99, 'Monday1')" > Are Monday1 and Sunday1 variable names? > onclick="toggle(Monday1,true,Sunday1,true);addUp(99,'Monday1')" > Or, reverse them if you need the order reversed in execution: > onclick="addUp(99,'Monday1');toggle(Monday1,true,Sunday1,true)" > -- > Randy > Chance Favors The Prepared Mind > comp.lang.javascript FAQ -http://jibbering.com/faq/index.html > Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
Thank your, it will work, but now the 2 other check boxes that it is supposed to turn on and off with the toggle wont add at all,(when its toggled or not) <td align="center" valign="bottom"><input name="Sunday1" type="checkbox" id="Sunday1" onclick="addUp(99, 'Sunday1')"value="Attending"></td> <td align="center" valign="bottom"><input name="Monday1" type="checkbox" id="Monday1" onclick="addUp(99, 'Monday1')"value="Attending"></td> <td align="center" valign="bottom"><input name="Both1" type="checkbox" id="Both1" onclick="addUp(169,'Monday1');toggle(Monday1,true,Sunday1,true)" > </td>
|
 |
 |
 |
 |
|