I tried a modified version of this code, and I am having one tiny problem: The text box is visible from the beginning, but it goes away when you click on a non-other response. Is there a way to make the text box hidden until 'other' is selected?
Code:
//Javascript Text//
<script type="text/javascript">
function reset()
{
var labl=document.getElementById('labl');
var other=document.getElementById('Title_Other');
labl.style.display='none';
other.style.display='none';
}
window.onload=function()
{
var labl=document.getElementById('labl');
var slect=document.getElementById('Title_Position');
var other=document.getElementById('Title_Other');
slect.onchange=function()
{
switch(slect.value)
{
case '15':
reset();
labl.style.display='';
labl.innerHTML='';
other.style.display='';
break;
default:
reset();
}
}
}
</script>
//HTML Text//
Title/Position
<SELECT NAME="Title_Position">
<OPTION SELECTED VALUE=""></OPTION>
<OPTION VALUE="1">President, VP, Other Executive</OPTION>
<OPTION VALUE="2">Pathologist, Other MD</OPTION>
<OPTION VALUE="3">Director, Assistant Director</OPTION>
<OPTION VALUE="4">Lab Manager, Lab Administrator</OPTION>
<OPTION VALUE="5">Med Tech, Chief Med Tech</OPTION>
<OPTION VALUE="6">Lab Supervisor</OPTION>
<OPTION VALUE="7">POCT, QA, Coordinator</OPTION>
<OPTION VALUE="8">Lab Technologist</OPTION>
<OPTION VALUE="9">Buyer, Purchasing Agent</OPTION>
<OPTION VALUE="10">Research or Development Scientist, Engineer</OPTION>
<OPTION VALUE="11">Manufacturing/ Operations</OPTION>
<OPTION VALUE="12">Marketing, Sales, Analysis</OPTION>
<OPTION VALUE="13">Clinical, Regulatory Affairs</OPTION>
<OPTION VALUE="14">Educator, Student</OPTION>
<OPTION VALUE="16">Consultant</OPTION>
<OPTION VALUE="17">Associate, Partner</OPTION>
<OPTION VALUE="18">Finance, Financial Analysis</OPTION>
<OPTION VALUE="15">Other</OPTION>
</SELECT>
<label id="labl"></label>
<input type="text" name="Title_Other" value="">
Also, I'd like to make a block of questions available only for certain responses. For example, if they are a student, I'd like to know their major and year, but if they were a president, I'd ask what kind of company they are in, etc. And of course, I would prefer for these questions to remain hidden unless these options were selected. Is there a way to do this without causing too many problems?
Thanks in advance!
Bookmarks