Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a checkbox readonly?

Status
Not open for further replies.

adamocean

Programmer
Nov 1, 2002
9
CA
I tried using readonly after it but it doesn't work? Disabled does work, but our client doesn't like it and we can't use it.

Any ideas?
 
<html>
<head>
<script language = &quot;javascript&quot;>
function readonly(box){
if (box.checked){
box.checked = false;
}else{ box.checked = true;}
box.blur();
}
</script>
</head>
<body>
<form name = &quot;test&quot;>
Yes: <input type = &quot;checkbox&quot; name = &quot;testbox&quot; value = &quot;yes&quot; onfocus = &quot;readonly(this)&quot; checked><br>
No: <input type = &quot;checkbox&quot; name = &quot;testbox&quot; value = &quot;no&quot; onfocus = &quot;readonly(this)&quot;>

</form>
</body>
</html>
 
also
thread216-450209 _______________________________________________
[sub]{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }[/sub]
_______________________________________________
for the best results to your questions: FAQ333-2924

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top