checkbox
to check(to set to true), I am using JavaScript as follows
first_question.checked == true;
and its working fine, but its not working when I am trying to reset(uncheck, or trying to set its value to false). Here is the code:
first_question.checked == false;
Is anyone knows what wrong with this code?
Thanks!
Vincent Puglia posted this at 01:35 — 20th July 2000.
They have: 634 posts
Joined: Dec 1999
Hi,
Neither should work. You are using the comparison symbol instead of the assignment symbol.
question1.checked == true is asking if the statement is true.
If you want to assign a value, you need to use 1 equal sign. As in:
question1.checked = true;
question1.checked = false;
If you want to know if it is checked or not, you use:
if (question1.checked)
you do not need to say "== true" or "== false".
Vinny
Where the world once stood
the blades of grass cut me still
dhaliwam posted this at 15:41 — 20th July 2000.
They have: 39 posts
Joined: Jun 2000
Sorry that was typo error, I was using
first_question.checked == true;
first_question.checked = false;
last_question.checked = false;
I guess it was nescape, which was causing problems
dhaliwam posted this at 15:42 — 20th July 2000.
They have: 39 posts
Joined: Jun 2000
Sorry that was typo error, I was using
first_question.checked = false;
last_question.checked = false;
I guess it was nescape, which was causing problems
Vincent Puglia posted this at 22:27 — 20th July 2000.
They have: 634 posts
Joined: Dec 1999
So everything's ok now?
Vinny
dhaliwam posted this at 14:23 — 21st July 2000.
They have: 39 posts
Joined: Jun 2000
Yes, everything is OK.
Thanks!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.