Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] FW: greying out checkboxes
- From: javascript@xxxxxxxxxx (Kipp Spanbauer)
- Subject: [Javascript] FW: greying out checkboxes
- Date: Fri, 20 Dec 2002 11:44:07 -0500
Philip: Here's the code that I used: <HTML> <HEAD> <SCRIPT LANGUAGE=3D"JavaScript"> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Original: Mike Elkins (m_c_elkins@xxxxxxxxxxx) --> <!-- Modified: Kipp Spanbauer (kippspanbauer@xxxxxxxxx) --> <!-- Modifiied script will disable checkboxes that are unused. --> <!-- Begin function selectivecheck(field, myselection) { var fieldid; var pos; var criteria; var strng; strng =3D myselection.value; for (i=3D0; i<field.length; i++) { if (strng=3D=3D"all") { field[i].checked =3D true; field[i].disabled =3D false; } else { fieldid =3D field[i].id; pos =3D strng.substring(0,1); criteria =3D strng.substring(1,2); //this gets the = information we want to evaluate if (fieldid.substring(pos,pos+1)=3D=3Dcriteria) { field[i].checked =3D true; field[i].disabled =3D false; } else { field[i].checked =3D false; //you could leave this out = if you don't want to clear the check boxes field[i].disabled =3D true; } } } } // End --> </script> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <form> <table align=3D"center"> <tr><td> <!--Load each ID with a string that will be parsed later --> <input id=3Da1 type=3Dcheckbox name=3Dlist value=3D"1">Group A = SubGroup 1<br> <input id=3Da2 type=3Dcheckbox name=3Dlist value=3D"2">Group A = SubGroup 2<br> <input id=3Db1 type=3Dcheckbox name=3Dlist value=3D"3">Group B = SubGroup 1<br> <input id=3Db2 type=3Dcheckbox name=3Dlist value=3D"4">Group B = SubGroup 2<br> <input id=3Dc1 type=3Dcheckbox name=3Dlist value=3D"5">Group C = SubGroup 1<br> <input id=3Dc2 type=3Dcheckbox name=3Dlist value=3D"6">Group C = SubGroup 2<br> <!--Set your option values that contain a position and then the = criteria--> <p> Group Selection: <select size=3D"1" name=3D"mycombobox" = onChange=3D"selectivecheck(this.form.list, this.form.mycombobox);"> <option value=3D"all">All Groups</option> <option value=3D"0a ">Group A</option> <option value=3D"0b ">Group B</option> <option value=3D"0c ">Group C</option> <option value=3D"11 ">SubGroup 1</option> <option value=3D"12 ">SubGroup 2</option> </select> <br> <div align=3D"center"> <input type=3D"button" value=3D"Select Group" = onclick=3D"selectivecheck(this.form.list, this.form.mycombobox)"> </div> </td></tr> </table> </form> <p><center> <font face=3D"arial, helvetica" size"-2">Free JavaScripts provided<br> by <a href=3D"http://javascriptsource.com">The JavaScript = Source</a></font> </center><p> </BODY></HTML> Good luck, Kipp Spanbauer kipp.spanbauer@xxxxxxx -----Original Message----- From: Kipp Spanbauer Sent: Fri 12/20/2002 9:55 AM To: phumes1@xxxxxxxxxx Cc: phil.humeniuk@xxxxxxxxxx; javascript@xxxxxxxxxx Subject: greying out checkboxes Philip: I had the same question that you did regarding greying out javascript = checkboxes and found my answer on a macromedia website: = http://www.macromedia.com/v1/documents/hs4/html_reference/Forms/input.htm= Basically, all you need is the word "DISABLED" in the along with the = INPUT tag. Example: <input class=3D"formbuttons" DISABLED type=3D"checkbox" name=3D"select" = value=3D"mcp">User=20 must change password at next login<br> That should do it for you. I found your message at: https://lists.latech.edu/pipermail/javascript/2002-April/003356.html Thanks, Kipp Spanbauer kipp.spanbauer@xxxxxxx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Philip Humeniuk's message read as follows: Hi, I have the following input boxes in my index.htm file. What I would like = to=20 happen is if the user checks the box "User must change password at next=20 login" I want the "User cannot change password" and "Password never=20 expires" checkboxes grayed out and possibly the text also so they cannot = check those. The only other option to check would be the "Account is = disabled" Can this be easilty done with JS? <input class=3D"formbuttons" type=3D"checkbox" name=3D"select" = value=3D"mcp">User=20 must change password at next login<br> <input class=3D"formbuttons" type=3D"checkbox" name=3D"select" = value=3D"ccp">User=20 cannot change password<br> <input class=3D"formbuttons" type=3D"checkbox" name=3D"select"=20 value=3D"pne">Password never expires<br> <input class=3D"formbuttons" type=3D"checkbox" name=3D"select" = value=3D"ad">Account=20 is disabled
- Prev by Date: [Javascript] Mac IE oddities with rollover help pop-ups
- Next by Date: [Javascript] Focus in Netscape 6.1 and above
- Previous by thread: [Javascript] Mac IE oddities with rollover help pop-ups
- Next by thread: [Javascript] Focus in Netscape 6.1 and above
- Index(es):