I want to be able to check a box and have certain text boxes come available, then check a different box and them to not be available, is this possible?
I.e. check box a enables text box 3
check box b enables text box 4 & disables 3
first check for the checked condition
if(document.formname.checkboxname.checked = true) {
now that you have that you can disable things
document.formname.textboxname.disabled = true or false ---------------------------------------
{ str = "sleep is good for you. sleep gives you the energy you need to function";
ptr = /sleep/gi;Nstr = str.replace(ptr,"coffee"alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924
I've used the code:
<script language="javascript">
if (document.Relationship.WholeRel.checked=true)
{document.relationship.groupstat.disabled=false}
</script>
However, i get the following error:
document.Relationship.wholerel is null or not an object.
My form is called Relationship
Checkbox is called WholeRel
Dropdown is called GroupStat
in the code you posted your caps are inconsistent. Javascript needs the elements to be referenced exactly how they are named, its case sensitive. So you might need to check that the checkbox input is WholeRel and not wholerel...
joezapp
just for information purposes, when checking for a booean value it is = not ==
watch for inconsistencies as you have shown in the code above with both = and == checking for the value. This can acause errors with in different browsers as different browsers will interprute the code in different ways ---------------------------------------
{ str = "sleep is good for you. sleep gives you the energy you need to function";
ptr = /sleep/gi;Nstr = str.replace(ptr,"coffee"alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.