djtizzlemaster
Programmer
I am creating an order form. There is a drop-down list for Referral (<select name="referral">). The options are like Internet, Magazine, etc. The option of particular interest here is Other. If (and only if) the user select Other from the drop-down list, I want a text field to appear. Here's how I'm trying to go about doing it:
~~~The event:
<option onclick="otherz()">(Other)</option>
~~~The function:
<head>
<script type="text/javascript">
<!--
function otherz() {
var other_var = "true"
}
//-->
</script>
</head>
~~~The if statement in the body:
<script type="text/javascript">
<!--
if(other_var == "true"){
document.write("<td>Other:</td><td><input type='text' size='20' maxlength='40' name='other_referral'></td>");
} else {
document.write("<td> </td><td> </td>");
}
//-->
</script>
~~~
Where am I going wrong?
~~~The event:
<option onclick="otherz()">(Other)</option>
~~~The function:
<head>
<script type="text/javascript">
<!--
function otherz() {
var other_var = "true"
}
//-->
</script>
</head>
~~~The if statement in the body:
<script type="text/javascript">
<!--
if(other_var == "true"){
document.write("<td>Other:</td><td><input type='text' size='20' maxlength='40' name='other_referral'></td>");
} else {
document.write("<td> </td><td> </td>");
}
//-->
</script>
~~~
Where am I going wrong?