How to make a check box disable?

<input type=checkbox name=mimi>

Can I  make mimi disabled so that no one can uncheck it?

How can I accomplish this by Javascript?
 

Thanks
hualingAsked:
Who is Participating?
 
matrix717Connect With a Mentor Commented:
try this:

document.form1.mimi.disabled='True'
0
 
knightEknightCommented:
actually, that should be:

document.nameofmyform.mimi.disabled=true;

.... and for Netscape, you must do this:

<INPUT type='checkbox' name='mimi' onFocus='this.blur();'>
0
 
hualingAuthor Commented:
Dear you,
You suggestion is work.
But now I want a button click to arouse the input checkbox disabled.

I tried this:
<input type=button nclick="document.forms[0].mimi=this.blur();">  
but failed.

I need a smooth code work well on both IE & NN

THANKS !
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Michel PlungjanIT ExpertCommented:
If you need it to be disabled when the page loads, you need to tell netscape it is:
<body onLoad="document.myForm.mimi.disabled=true">

<FORM NAME="myForm">
<INPUT NAME="mimi" TYPE="checkbox" onClick="if (this.disabled) this.checked=false">
<INPUT TYPE="button" onClick="this.form.mimi.disabled=true">
</FORM>

it will work in both browsers but be more visible in IE.

Michel

0
 
TYoungCommented:
<INPUT NAME="mimi" TYPE="checkbox" disabled>
0
 
Michel PlungjanIT ExpertCommented:
TYoung - that is how to initialise it in IE only and will disable it from the load of the page.
My script will disable the checkbox at will and work in Netscape too

Michel
0
All Courses

From novice to tech pro — start learning today.