Dale_G Posted December 22, 2007 Share Posted December 22, 2007 Hey everyone, as you can see I'm new here. I'm working on a new section for a site. Basically it's a layout creator, mostly, with a few customization options. Basically as you can see from the HTML below, there is a checkbox with the id "network" and a text input field with the id "username". <div style="text-align: left;"> <b>2. Creation</b> </div> <br> Here you can customize <br><br> <table align="center" cellpadding="5" width="95%" style="margin: 3px; padding: 5px; border: 2px solid black;"> <tr> <td align="center"> <table align="center" width="98%" cellspacing="1" cellpadding="3"> <tr> <td width="50%" style="text-align: center;">Replace the Extended Network Logo with your Dynamic Signature (?)<br><input type="checkbox" id="network" name="network" style="border:none;" value="_s" /></td> <td width="50%" style="text-align: center;">Hide the Comments section (?)<br><input type="checkbox" id="comments" name="comments" style="border:none;" value="_p" /></td> </tr> </table> <input type="text" id="username" size="20" maxlength="12"> <br> <font size="1">If you checked "Replace Extended Network Logo" you MUST enter your name here so the Signature can be created. Otherwise your signature WILL NOT DISPLAY.<br><br>If you'd like to keep the Extended Network Logo LEAVE THE ABOVE FIELD BLANK!</font> <hr> <input type="button" value="Generate my Layout!" style="text-align: center;" onClick="make_sig()" onSubmit="make_sig()"> <div id="urlbox"></div> </table> <br> </td> </td> </table> Basically, I need to know how I can have the username field disabled by default, and then enabled only WHILE the network checkbox is checked. I'm not too sure how to do this. But I have some sort of idea. Perhaps something like this (excuse the sloppy and incorrect structure, this is just to demonstrate) if (document.getElementById("network").checked==true THEN document.getElementById("username").disabled==false) You know, basically something stating WHILE the network checkbox is checked the username field will be enabled and if network is unchecked, username becomes disabled. Thanks. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 22, 2007 Share Posted December 22, 2007 <script language="javascript"> function Newtworking() { var cb1 = document.getElementById('network').checked; if (cb1 == true) { document.getElementById('username').disabled = false; } else if (cb1 != true) { document.getElementById('username').disabled = true; } } </script> <div style="text-align: left;"> <b>2. Creation</b> </div> <br> Here you can customize <br><br> <table align="center" cellpadding="5" width="95%" style="margin: 3px; padding: 5px; border: 2px solid black;"> <tr> <td align="center"> <table align="center" width="98%" cellspacing="1" cellpadding="3"> <tr> <td width="50%" style="text-align: center;">Replace the Extended Network Logo with your Dynamic Signature (?)<br><input type="checkbox" id="network" name="network" style="border:none;" value="_s" onclick="Newtworking()" /></td> <td width="50%" style="text-align: center;">Hide the Comments section (?)<br><input type="checkbox" id="comments" name="comments" style="border:none;" value="_p" /></td> </tr> </table> <input type="text" id="username" size="20" maxlength="12" disabled> <br> <font size="1">If you checked "Replace Extended Network Logo" you MUST enter your name here so the Signature can be created. Otherwise your signature WILL NOT DISPLAY.<br><br>If you'd like to keep the Extended Network Logo LEAVE THE ABOVE FIELD BLANK!</font> <hr> <input type="button" value="Generate my Layout!" style="text-align: center;" onClick="make_sig()" onSubmit="make_sig()"> <div id="urlbox"></div> </table> <br> </td> </td> </table> Quote Link to comment Share on other sites More sharing options...
Dale_G Posted December 22, 2007 Author Share Posted December 22, 2007 <script language="javascript"> function Newtworking() { var cb1 = document.getElementById('network').checked; if (cb1 == true) { document.getElementById('username').disabled = false; } else if (cb1 != true) { document.getElementById('username').disabled = true; } } </script> <div style="text-align: left;"> <b>2. Creation</b> </div> <br> Here you can customize <br><br> <table align="center" cellpadding="5" width="95%" style="margin: 3px; padding: 5px; border: 2px solid black;"> <tr> <td align="center"> <table align="center" width="98%" cellspacing="1" cellpadding="3"> <tr> <td width="50%" style="text-align: center;">Replace the Extended Network Logo with your Dynamic Signature (?)<br><input type="checkbox" id="network" name="network" style="border:none;" value="_s" onclick="Newtworking()" /></td> <td width="50%" style="text-align: center;">Hide the Comments section (?)<br><input type="checkbox" id="comments" name="comments" style="border:none;" value="_p" /></td> </tr> </table> <input type="text" id="username" size="20" maxlength="12" disabled> <br> <font size="1">If you checked "Replace Extended Network Logo" you MUST enter your name here so the Signature can be created. Otherwise your signature WILL NOT DISPLAY.<br><br>If you'd like to keep the Extended Network Logo LEAVE THE ABOVE FIELD BLANK!</font> <hr> <input type="button" value="Generate my Layout!" style="text-align: center;" onClick="make_sig()" onSubmit="make_sig()"> <div id="urlbox"></div> </table> <br> </td> </td> </table> I had a feeling you'd be the one who'd answer my cry! Thank you very much. You're Member Title is well deserved! I'm not sure if you're thanked alot, but, from the browsing I've done around the site while waiting for my answer I see that you're one, if not the most, helpful people here! So thanks! Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 22, 2007 Share Posted December 22, 2007 Thank You For The Nice Comments - Your Very Welcome! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.