473,799 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,t rue)"
"addUp(99, 'Monday1')"

thanks for your help

Josh

Mar 20 '07 #1
3 15927
ma**********@gm ail.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,t rue)"
"addUp(99, 'Monday1')"
Are Monday1 and Sunday1 variable names?

onclick="toggle (Monday1,true,S unday1,true);ad dUp(99,'Monday1 ')"

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

onclick="addUp( 99,'Monday1');t oggle(Monday1,t rue,Sunday1,tru e)"

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript 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...@gm ail.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,t rue)"
"addUp(99, 'Monday1')"

Are Monday1 and Sunday1 variable names?

onclick="toggle (Monday1,true,S unday1,true);ad dUp(99,'Monday1 ')"

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

onclick="addUp( 99,'Monday1');t oggle(Monday1,t rue,Sunday1,tru e)"

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptT oolbox.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')"valu e="Attending" ></td>
<td align="center" valign="bottom" ><input name="Monday1"
type="checkbox" id="Monday1" onclick="addUp( 99,
'Monday1')"valu e="Attending" ></td>
<td align="center" valign="bottom" ><input name="Both1"
type="checkbox" id="Both1"
onclick="addUp( 169,'Monday1'); toggle(Monday1, true,Sunday1,tr ue)" >
</td>

Mar 21 '07 #3
In comp.lang.javas cript message <11************ *********@d57g2 000hsg.goo
glegroups.com>, Tue, 20 Mar 2007 15:41:19, ma**********@gm ail.com
posted:
>How do you apply 2 onclick events to a check box.
>"toggle(Monday 1,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.c om/faq/index.html>.
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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
10210
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 validation. The problem is.. how can I code the submit()s so the CGI's form collection knows which 'element' was clicked?? I am NOT permitted to use <input type=image...> or any "button" that browsers produce for forms.... the reasons are all client...
4
12291
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) & (FileAttributes.ReadOnly | FileAttributes.Archive )) {
0
1137
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 compress box. Would someone point me in the right direction? I have no idea what I am doing wrong.
4
1736
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 weeks) you cant 'embed' them in the custom controls. Someone correct me if I'm wrong (and please point to an example :) ) So, to get around this, I'm using Javascript. In my control, I'm doing
1
2000
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 simply replaces the attribute I created rather than adding new values to the existing attribute. Which makes sense. But what if I want to append values to a single attribute. What's the proper way to do that?
1
1506
by: Andreas Mueller | last post by:
Hi all, I have an attribute class: class MyAttribute : Attribute { public MyAttribute(){ } }
3
1238
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. Is this what will happen consistently across browsers? Brian
1
1560
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
3014
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" onclick="document.forms.action='javascript:ChangeNum1();'"/> </form> What the above code does is change the action state, it allows me to have multiple image inputs which is great as I can define various inputs with different IDs.
0
10473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10249
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10219
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10025
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7563
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5584
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.