471,887 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

checkbox onclick check another checkbox

Title says all, if a user check checkbox1 chechbox3 will also be checked,
how do I do this? Have searched around but kan only find out how to check
the same box

Terje
Jul 23 '05 #1
5 34535
Terje wrote on 17 nov 2004 in comp.lang.javascript:
Title says all, if a user check checkbox1 chechbox3 will also be checked,
how do I do this? Have searched around but kan only find out how to check
the same box


<input type=checkbox
onclick="if(this.checked)
document.getElementById('cb3').checked=true">check box1<br>

<input type=checkbox id=cb3>checkbox3

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 23 '05 #2
tanks....

"Evertjan." <ex**************@interxnl.net> skrev i melding
news:Xn********************@194.109.133.29...
Terje wrote on 17 nov 2004 in comp.lang.javascript:
Title says all, if a user check checkbox1 chechbox3 will also be checked, how do I do this? Have searched around but kan only find out how to check the same box


<input type=checkbox
onclick="if(this.checked)
document.getElementById('cb3').checked=true">check box1<br>

<input type=checkbox id=cb3>checkbox3

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 23 '05 #3
Evertjan. wrote:

<input type=checkbox
onclick="if(this.checked)
document.getElementById('cb3').checked=true">check box1<br>

<input type=checkbox id=cb3>checkbox3


<input type="checkbox"
onclick="document.getElementById('cb3').checked=th is.checked"> checkbox1<br>

<input type="checkbox" id="cb3">checkbox3

Mick
Jul 23 '05 #4
"Terje" <te***@cyberfactory.no> wrote in message news:<tS********************@news000.worldonline.d k>...
tanks....

"Evertjan." <ex**************@interxnl.net> skrev i melding
news:Xn********************@194.109.133.29...
Terje wrote on 17 nov 2004 in comp.lang.javascript:
Title says all, if a user check checkbox1 chechbox3 will also be checked, how do I do this? Have searched around but kan only find out how to check the same box


<input type=checkbox
onclick="if(this.checked)
document.getElementById('cb3').checked=true">check box1<br>

<input type=checkbox id=cb3>checkbox3

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)


Title doesn't really 'say it all'...what happens when the user
un-checks checkbox3? Oh, well....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>untitled</title>
</head>
<body>
<form style="width:100px;">
<input type="checkbox" name="checkbox1" value="on"
onclick="checkbox3.checked=this.checked" /> checkbox1
<input type="checkbox" name="checkbox2" value="on" /> checkbox2
<input type="checkbox" name="checkbox3" value="on" /> checkbox3
</form>
</body>
</html>
Jul 23 '05 #5
Mick White wrote on 18 nov 2004 in comp.lang.javascript:
Evertjan. wrote:

<input type=checkbox
onclick="if(this.checked)
document.getElementById('cb3').checked=true">check box1<br>

<input type=checkbox id=cb3>checkbox3


<input type="checkbox"
onclick="document.getElementById('cb3').checked=th is.checked">
checkbox1<br>

<input type="checkbox" id="cb3">checkbox3


Very nice, but not what the OP asked !!!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by LRW | last post: by
1 post views Thread by Michel Bany | last post: by
9 posts views Thread by morellik | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

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.