Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion CheckBox
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
-Lost  
View profile  
 More options May 24 2007, 5:43 pm
Newsgroups: comp.lang.javascript
From: -Lost <maventheextrawo...@techie.com>
Date: Thu, 24 May 2007 17:43:21 -0400
Local: Thurs, May 24 2007 5:43 pm
Subject: Re: CheckBox

Jeff Johns wrote:
> HTML
> <input type="checkbox" name="test" id="test" value="1"
> onclick="check_it(this);" />
> <input type="checkbox" name="test" id="test1" value="2"
> onclick="check_it(this);" />

> SCRIPT
> function check_it(obj)
> {
>     if (this.id == 'test' && this.checked) {
>          document.getElementById('test1').checked = false;
>     }
>     elseif (this.id == 'test1' && this.checked) {
>          document.getElementById('test').checked = false;
>     }
> }

> This is just a very simple way to do it.

Too bad it doesn't work as is.

All instances of "this" in your "SCRIPT" block should be "obj".

Also, there is no such thing as an "elseif" in JavaScript.  You meant
"else if".

--
-Lost
Remove the extra words to reply by e-mail.  Don't e-mail me.  I am
kidding.  No I am not.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.