Link to home
Start Free TrialLog in
Avatar of weaponX
weaponX

asked on

Using onCheck() to "lock" checkboxes

I want to put two columns of checkboxes on a page...

one column labeled "yes", one labeled "no".

I want the "yes" boxes to all be checked...I don't want them to be uncheckable...if you try to uncheck it, I want a blur() or something to occur so the "checked" value is retained.

I want the "no" boxes all unchecked and I don't want them to be checkable.

I am trying somethinglike this...

<form name="checks">
<input type="checkbox" name="box1" onCheck=document.checks.box1.checked = false;>
</form>

or

<form name="checks">
<input CHECKED type="checkbox" name="box1" onCheck=document.checks.box1.checked = true;>
</form>

Obviously this isn't working if I'm here asking you guys...

Anyone up on the lockage of the boxage???

Bueller?

Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Checkboxes are kept in the dom as an array so you need to in clude an index to refrerence them that way.  It is better to use:
<input CHECKED type="checkbox" name="box1" onCheck=this.checked = true;>

That way the reference is unambitguous.

Cd&
ASKER CERTIFIED SOLUTION
Avatar of ivanmata
ivanmata

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of weaponX
weaponX

ASKER

this place ROCKS...service I tell you.

I appreaciate the effort COBOLsaurus :p

BUT

ivanmata is right across the board.


ivan, take the 20 piece if you want it...I woulda made it worth more but I don't have many points to spend and I don't know many answers to earn more..

thumbsup!!