peterb1985
MIS
I'm trying to use the onChange event so that when other is selected from drop-down by div tag opens showing textbox.
Here's what i've got but it doesn't work:
<script language="JavaScript">
function other(){
var ind = document.frmColdCall.reason.selectedIndex;
var val = document.frmColdCall.reason.options[ind].value;
if (val == 2){
document.getElementById(rother).style.display="block";
}
if (val != 2){
document.getElementById(rother).style.display="none";
}
return true;
}
</script>
<tr>
<td></td>
<td>#recno#</td>
<td><select name="reason" onChange="other();">
<option value="0">No Answer</option>
<option value="1">Not Interested</option>
<option value="2">Other</option>
</select></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td><div id="rother" style="display:none;"><input type="text" name="other" value="" size="20" maxlength="50"></div></td>
</tr>
Here's what i've got but it doesn't work:
<script language="JavaScript">
function other(){
var ind = document.frmColdCall.reason.selectedIndex;
var val = document.frmColdCall.reason.options[ind].value;
if (val == 2){
document.getElementById(rother).style.display="block";
}
if (val != 2){
document.getElementById(rother).style.display="none";
}
return true;
}
</script>
<tr>
<td></td>
<td>#recno#</td>
<td><select name="reason" onChange="other();">
<option value="0">No Answer</option>
<option value="1">Not Interested</option>
<option value="2">Other</option>
</select></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td><div id="rother" style="display:none;"><input type="text" name="other" value="" size="20" maxlength="50"></div></td>
</tr>