Jump to content

Recommended Posts

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=false
else
document.form1.test6.disabled=false
}
}
function disable6(){
if (document.all || document.getElementById){
if (document.form1.test6.disabled==true)
document.form1.test6.disabled=true
else
document.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]
Link to comment
https://forums.phpfreaks.com/topic/3533-firefox-opera-dig-it-ie-doesnt/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.