h8ids Posted February 22, 2006 Share Posted February 22, 2006 Why does IE suck? Save that one for another thread.Using JavaScript to disable and enable a textarea based upon a drop down selection. All options, but the last one, in the selection box are set to disable the textarea. The text area is set to disabled by default.All entered text and the drop down selection are to be saved to a database.Here's the source:[code]<html><body><form method="POST" action="dataincourse.php" name="form1"><script>function enable6(){if (document.all || document.getElementById){if (document.form1.test6.disabled==true)document.form1.test6.disabled=falseelsedocument.form1.test6.disabled=false}}function disable6(){if (document.all || document.getElementById){if (document.form1.test6.disabled==true)document.form1.test6.disabled=trueelsedocument.form1.test6.disabled=true}}</script><!--how often will the course be taught--><br><font color="#FFFFFF"><a name="offer"></a><b>10.</b> How often will the course be taught? </font><select size="1" name="dropdown" style="background-color: lightyellow"><option name="dairy" value="Please Choose One" onclick="disable6()">Please Choose One</option><option name="protein" value="On a regular basis - Probably Annually" onclick="disable6()">On a regular basis - Probably Annually</option><option name="protein" value="On a regular basis - Probably Biennually" onclick="disable6()">On a regular basis - Probably Biennually</option><option name="protein" value="One time only" onclick="disable6()">One time only</option><option name="protein" value="Other - Please specify" onclick="enable6()">Other - Please specify</option></select><!--<select style='background-color: lightyellow' name="Offered"> <option value="Please Choose One">Please Choose One</option> <option value="On a regular basis - Probably annually">On a regular basis - Probably annually</option> <option value="On a regular basis - Probably biennually">On a regular basis - Probably biennually</option> <option value="One time only">One time only</option> <option value="Other - Please specifiy">Other - Please specifiy</option></select>--><br><font color="#FFFFFF"><b>Other specification: </b></font><textarea id="test6" type="text" style="background-color: lightyellow" name="OtherOffered" cols="58" maxlength="500" disabled></textarea></span></form></body></html>[/code] 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.