473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

Mar 20 '07 #1
3 15903
ma**********@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(9 9,'Monday1')"

Or, reverse them if you need the order reversed in execution:

onclick="addUp(99,'Monday1');toggle(Monday1,true,S unday1,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/
Mar 21 '07 #2
On Mar 20, 7:57 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
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(9 9,'Monday1')"

Or, reverse them if you need the order reversed in execution:

onclick="addUp(99,'Monday1');toggle(Monday1,true,S unday1,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>

Mar 21 '07 #3
In comp.lang.javascript message <11*********************@d57g2000hsg.goo
glegroups.com>, Tue, 20 Mar 2007 15:41:19, ma**********@gmail.com
posted:
>How do you apply 2 onclick events to a check box.
>"toggle(Monday1,true,Sunday1,true)"
"addUp(99, 'Monday1')"
function Clunk() {
toggle(Monday1, true, Sunday1, true)
addUp(99, 'Monday1') }

<input type=checkbox onClick="Clunk()">

is a good approach, for legibility, especially if the code to be
executed gets longer.

Assuming that your E-address does not express affection for raincoats :
Does my site work well on Macs ?

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Mar 21 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: charlie_M | last post by:
I have a number of applications where I want to have many onclick='submit()' attached to different 'elements' on a single form ..... which sends the form to a CGI "script" which does all the...
4
by: Pete Kane | last post by:
Hello all, how can I check for multiple file attributes using bitwise operators ? I'm thinking along the lines of string fname = "c:\\test.txt"; if(File.GetAttributes(fname) &...
0
by: Next | last post by:
Hello, I am trying to uncheck the archive box and check the compress box for a given file. I am having trouble. It seems I can uncheck the archive box but nothing I've tried will check the...
4
by: Samuel Hon | last post by:
Hi I'm building a custom control which basically takes data from the user and then submits it. I would use the validator controls but if I understand correctly (I've been working with .Net for 2...
1
by: darrel | last post by:
On some of my pages I add a javascript call dynamically to the BODY tag: pageBody.Attributes.add("onload", "dothis();") Since this adds an actual attribute, trying to call this multiple times...
1
by: Andreas Mueller | last post by:
Hi all, I have an attribute class: class MyAttribute : Attribute { public MyAttribute(){ } }
3
by: brian.lukoff | last post by:
What happens when there are multiple onclick attributes on a single tag: <input type="radio" onclick="alert('first')" onclick="alert('second')"> On Firefox and IE6, only the first is executed....
1
by: libsfan01 | last post by:
hi how can u set the onclick attributes of a 'createelement' created element? such as giving it an onclick event? regards Marc
3
by: Keenan | last post by:
Hello, I am using this code <form style="display: none;" name="num1form" id="num1form" action=""> <input type="image" name="1" id="num1" value="1" src="imgl/img_first_01.png"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.