Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop down list

Status
Not open for further replies.

exphtur

Technical User
Jul 23, 2003
23
IE
At the moment I  have individual search input boxes that search for movies by Actor , by Title and  by Director.  The actor search calls up the script Actor.asp, Title calls Title.asp and Director calls Director.asp.  What I want is to have one input box and a drop down list with the options of Actor, Title, Director like the code below.  My question is by doing this drop down list  method how do I redirect to the ActorSearch.asp, TitleSearch.asp and DirectorSearch.asp depending on what the user chooses.
Is it some sort of Case Select and response.write redirect ?
<p align="left"><font size="1" face="Arial, Helvetica, sans-serif">Search For
  Movies</font></p>
<p><font size="1" face="Arial, Helvetica, sans-serif">
  <input name="textfield" type="text" size="20">
  </font></p>
<p>
  <select name="select" size="1">
    <option value="By Title" selected>By Title</option>
    <option value="By Actor">By Actor </option>
    <option value="By Director">By Director</option>
  </select>
</p>
Thanks in advance
 
Hi...
you can do it with javascript on the same page like this :
you have a form with a name like MyForm so :
Code:
<script language="javascript">
function frm_onsubmit(){
  switch(documrnt.MyForm.select.value){
    case 'By Title':
      documrnt.MyForm.action = 'TitleSearch.asp';
      break;
    case 'By Actor':
      documrnt.MyForm.action = 'ActorSearch.asp';
      break;
    case 'By Director':
      documrnt.MyForm.action = 'DirectorSearch.asp';
      break;
  }
  return true;
}
</script>

and then in your code, where you are creating your form, you will have :

Code:
<form name="MyForm" method ="post" onsubmit="return frm_submit()">

----
Harsh words break no bones but they do break hearts.
E.T.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top