PDA

View Full Version : How to add a table to a triple drop-down menu



magicstar7
Apr 6th, 2005, 06:52 PM
Hi! I was wondering if someone could help me add a table to one menu of a triple drop-down menu.

The 3 drop-down menus are:
1) Choose Location--Here there are 3 locations listed-DC, MD, VA
2) Choose Menu--Here there are 3 menu choices-View Stations, Add Inventory, Reports.
3) Choose Option--Once a user chooses MD as the Location and View Stations as the menu--this should being up a list of all the stations( 1,2,3, 4....)from an Inventory Stations table.

Here is the code:

<FORM name="isc">

<table width=60% align=center cellpadding=1 cellspacing=1>
<tr class=tabletd7 align="center">
<td class=tabletd7 nowrap height="11"> &nbsp;

<select name="example" class=fields size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>---Choose Location-----</option>
<option>DC Office</option>
<option>MD Office</option>
<option>VA Office</option>
</select>

<select name="stage2" class=fields size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Choose Menu--------</option>
</select>

<select name="stage3" class=fields size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Choose Option-------</option>
</select>

<script>
<!--

/*
Triple Combo Script Credit
By Hamid Cheheltani/ JavaScript Kit (http://www.javascriptkit.com)
Visit http://javascriptkit.com for this and over 400+ other scripts
*/

var groups=document.isc.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()

group[0][0]=new Option("---Select2---"," ");

group[1][0]=new Option("Now Select This One"," ");
group[1][1]=new Option("View Station","47");
group[1][2]=new Option("Inventory Reports","46");
group[1][3]=new Option("Add New Inventory","45");

group[2][0]=new Option("Now Select This One"," ");
group[2][1]=new Option("View Station","115");
group[2][2]=new Option("Inventory Reports","116");
group[2][3]=new Option("Add New Inventory","117");


group[3][0]=new Option("Now Select This One"," ");
group[3][1]=new Option("View Station","115");
group[3][2]=new Option("Inventory Reports","116");
group[3][3]=new Option("Add New Inventory","117");

var temp=document.isc.stage2


function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
redirect1(0)
}


var secondGroups=document.isc.stage2.options.length
var secondGroup=new Array(groups)
for (i=0; i<groups; i++) {
secondGroup[i]=new Array(group[i].length)
for (j=0; j<group[i].length; j++) {
secondGroup[i][j]=new Array() }}

secondGroup[0][0][0]=new Option("---Select 3---"," ");
secondGroup[1][0][0]=new Option("---Select 3---"," ");
secondGroup[1][1][0]=new Option("Now Select This One"," ");
secondGroup[1][1][1]=

-------------I WANT TO ADD THIS TABLE HERE----------------------------

<table width=40% align=center cellpadding=1 cellspacing=1>

View Station Details:&nbsp;&nbsp;&nbsp;<select name=StationID class=fields onchange="window.open('InventoryManagement.asp?StationID='+document.Page1.StationID.value, target='main');">
<option></option>
<% do while rs.eof<>true %>
<option <% if cint(request("StationID"))=cint(rs("StationID")) then %>selected<% end if %> value='<%=rs("StationID")%>'><%=rs("StationID")%></option>
<% rs.movenext
loop %>
</select></td>

</table>

-------------I WANT TO ADD THIS TABLE HERE----------------------------

new Option("Station4817","http://tweb/testintranet/InventoryManagement.asp?StationID=4817");
secondGroup[1][1][2]=new Option("Station4818","http://tweb/testintranet/InventoryManagement.asp?StationID=4818");
secondGroup[1][1][3]=new Option("Station4819","http://tweb/testintranet/InventoryManagement.asp?StationID=4819");

secondGroup[1][2][0]=new Option("Now Select This One"," ");
secondGroup[1][2][1]=new Option("Computers","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryComputers");
secondGroup[1][2][2]=new Option("Monitors","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryMonitors");
secondGroup[1][2][3]=new Option("Scanners","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryScanners");
secondGroup[1][2][4]=new Option("Phones","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryPhones");
secondGroup[1][2][5]=new Option("Printers","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryPrinters");


secondGroup[1][3][0]=new Option("Now Select This One"," ");
secondGroup[1][3][1]=new Option("Computer","http://tweb/testintranet/AddInventory.asp?InventoryType=InventoryComputers");
secondGroup[1][3][2]=new Option("Monitor","http://tweb/testintranet/AddInventory.asp?InventoryType=InventoryMonitors");

secondGroup[2][0][0]=new Option("---Select 3---"," ");
secondGroup[2][1][0]=new Option("Now Select This One"," ");
secondGroup[2][1][1]=new Option("Station4817","http://tweb/testintranet/InventoryManagement.asp?StationID=4817");
secondGroup[2][1][2]=new Option("Station4818","http://tweb/testintranet/InventoryManagement.asp?StationID=4818");
secondGroup[2][1][3]=new Option("Station4819","http://tweb/testintranet/InventoryManagement.asp?StationID=4819");

secondGroup[2][2][0]=new Option("Now Select This One"," ");
secondGroup[2][2][1]=new Option("Computers","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryComputers");
secondGroup[2][2][2]=new Option("Monitors","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryMonitors");
secondGroup[2][2][3]=new Option("Scanners","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryScanners");
secondGroup[2][2][4]=new Option("Phones","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryPhones");
secondGroup[2][2][5]=new Option("Printers","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryPrinters");

secondGroup[2][3][0]=new Option("Now Select This One"," ");
secondGroup[2][3][1]=new Option("Computer","http://tweb/testintranet/AddInventory.asp?InventoryType=InventoryComputers");
secondGroup[2][3][2]=new Option("Monitor","http://tweb/testintranet/AddInventory.asp?InventoryType=InventoryMonitors");


secondGroup[3][0][0]=new Option("---Select 3---"," ");
secondGroup[3][1][0]=new Option("Now Select This One"," ");
secondGroup[3][1][1]=new Option("Station4817","http://tweb/testintranet/InventoryManagement.asp?StationID=4817");
secondGroup[3][1][2]=new Option("Station4818","http://tweb/testintranet/InventoryManagement.asp?StationID=4818");
secondGroup[3][1][3]=new Option("Station4819","http://tweb/testintranet/InventoryManagement.asp?StationID=4819");

secondGroup[3][2][0]=new Option("Now Select This One"," ");
secondGroup[3][2][1]=new Option("Computers","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryComputers");
secondGroup[3][2][2]=new Option("Monitors","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryMonitors");
secondGroup[3][2][3]=new Option("Scanners","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryScanners");
secondGroup[3][2][4]=new Option("Phones","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryPhones");
secondGroup[3][2][5]=new Option("Printers","http://tweb/testintranet/InventoryReports.asp?InventoryType=InventoryPrinters");

secondGroup[3][3][0]=new Option("Now Select This One"," ");
secondGroup[3][3][1]=new Option("Computer","http://tweb/testintranet/AddInventory.asp?InventoryType=InventoryComputers");
secondGroup[3][3][2]=new Option("Monitor","http://tweb/testintranet/AddInventory.asp?InventoryType=InventoryMonitors");



var temp1=document.isc.stage3
function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){
temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value)
}
temp1.options[0].selected=true
}

function redirect2(z){
window.location=temp1[z].value
}

//-->
</script>

</td>
</tr>
</table>
</FORM>