469,323 Members | 1,575 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

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 34432
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.