Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>How to disable checkbox without "disable"?

How to disable checkbox without "disable"?

dep
03-15-2006, 06:40 PM
Hello. I want to disable a checkbox without adding "disable" to the HTML. Basically, I want it to LOOK like an enabled checkbox but when someone clicks on it, nothing happens. How can I accomplish this?

dep

_Aerospace_Eng_
03-15-2006, 07:00 PM
Hmm readonly only works on input boxes not checkboxes. Why are you doing this anyways? Why not just pass a hidden input value to symbolize the "untouchable checkbox"?

Beagle
03-15-2006, 07:28 PM
<input type="checkbox" onclick="return false;" />

dep
03-15-2006, 07:35 PM
well, it's for a validation status on category. the checkbox fills in when the category is complete... Problem is, on XP, if you don't have "fancy windows" turned on in your OS, it renders the 'disabled' elements in a very dark grey and you can't really see the checkbox's checked status..

dep
03-15-2006, 07:37 PM
btw onclick="return false;" works.

thanks!@

brothercake
03-16-2006, 01:46 AM
well, it's for a validation status on category. the checkbox fills in when the category is complete... Problem is, on XP, if you don't have "fancy windows" turned on in your OS, it renders the 'disabled' elements in a very dark grey and you can't really see the checkbox's checked status..
So you're saying, you want to do this because you don't think the appearance of a disabled control is good enough?

If so, that's entirely the wrong reason - having an element disabled is a semantic state, and if that's the state you mean (as it is) then that's the state you should use.

If you want to use scripting to read the state and restyle the checkbox, that's cool (it would be better to use the :disabled pseudo-class, but of course IE doesn't currently support that). But you should not use scripting to simulate a state which conflicts with the actual state of the element.

Am I making sense here?

Kor
03-16-2006, 05:46 PM
By short. Most users know how a disabled checkbox looks like. They must have been used with it till now. Changing the appeearance of an welknown element status will confuse al lot of them, I bet.


 

TOP

Hyperthreading hurts s
HP sharpens blade PC l
Apple goes for Quad po
Itanium gets scaled do

For more info

HP sharpens blade PC l
Hyperthreading hurts s
can not call click() i
script does not work o
smart menu 
write to an html file 
FireFox doesn't recogn
Changing e.keyCode (e.
Clearing a range creat
UPDATE: My mouse over 

News Archive

onChange Help 
beforeload? vs onload.
Problem with document.
decreasing my javascri
Problem with \\ and \ 
how to stop scrolling?
Change Label Text Colo
Can I forward a page b
2 javascript functions
Validating a textbox 

Related stories:

changing select box value
Help with Validating Form
Date() function pulling different code in different browsers.
Div help
Any moo.fx user here? Need help in hiding form.
How to save a newly opened page using JavaScript
Conditional statement to determine form action
Find on Page
problems with JS trying to get all quantity

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics