...

View Full Version : Resolved Help-Dynamic Dropdown List



drjabo
07-18-2011, 12:20 AM
Howdy,

So I have some javascript/html on one file (another.html) that I would like to split into two separate pages:

home2.html
cars.js

If you view the code for home2.html everything works up until the model form box. That's where my problem lies. I can get the code to work on another.html but I'm splitting it up incorrectly in home2.html

Help would be much appreciated.

PS: If you are going to gripe at me for not using PHP or SQL to make things easier (for future updates to code) at least link me to something to learn from then insult me. :thumbsup:

another.html


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" type="text/javascript">
function dropdownlist(list)
{

document.formname.subcategory.options.length=0;
switch (list)
{

case "bmw":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("3 Series");
document.formname.subcategory.options[2]=new Option("5 Series");
document.formname.subcategory.options[3]=new Option("Z Series");

break;

case "buick":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Century");
document.formname.subcategory.options[2]=new Option("Lesabre");
document.formname.subcategory.options[3]=new Option("Park Avenue");
document.formname.subcategory.options[4]=new Option("Regal");
document.formname.subcategory.options[5]=new Option("Riveria");

break;

case "cadillac":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Catera");
document.formname.subcategory.options[2]=new Option("Deville");
document.formname.subcategory.options[3]=new Option("El Dorado");
document.formname.subcategory.options[4]=new Option("Seville");

break

case "chevrolet":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Astro");
document.formname.subcategory.options[2]=new Option("Blazer S 10");
document.formname.subcategory.options[3]=new Option("Camaro");
document.formname.subcategory.options[4]=new Option("Corvette");
document.formname.subcategory.options[5]=new Option("G2500");
document.formname.subcategory.options[6]=new Option("Lumina");
document.formname.subcategory.options[7]=new Option("Malibu");
document.formname.subcategory.options[8]=new Option("Monte Carlo");
document.formname.subcategory.options[9]=new Option("Suburban");
document.formname.subcategory.options[10]=new Option("Tahoe");
document.formname.subcategory.options[11]=new Option("Ventur");

break

case "chrysler":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Town & Country");
document.formname.subcategory.options[2]=new Option("Cirrus");
document.formname.subcategory.options[3]=new Option("Concord");
document.formname.subcategory.options[4]=new Option("Sebring");

break;

case "dodge-plymouth":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Avenger");
document.formname.subcategory.options[2]=new Option("Breeze");
document.formname.subcategory.options[3]=new Option("Caravan Voyager");
document.formname.subcategory.options[4]=new Option("Durango");
document.formname.subcategory.options[5]=new Option("Intrepeid");
document.formname.subcategory.options[6]=new Option("Ram Van 1500");
document.formname.subcategory.options[7]=new Option("Ram Van 2500");


case "ford":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Contour");
document.formname.subcategory.options[2]=new Option("Crown Victoria");
document.formname.subcategory.options[3]=new Option("E150");
document.formname.subcategory.options[4]=new Option("E250");
document.formname.subcategory.options[5]=new Option("E350");
document.formname.subcategory.options[6]=new Option("Escort");
document.formname.subcategory.options[7]=new Option("Expedition");
document.formname.subcategory.options[8]=new Option("Explorer");
document.formname.subcategory.options[9]=new Option("Freestar");
document.formname.subcategory.options[10]=new Option("Mustang");
document.formname.subcategory.options[11]=new Option("Taurus");
document.formname.subcategory.options[12]=new Option("Windstar");

break;

case "gmc":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Jimmy S 15");

break;

case "honda":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Accord");
document.formname.subcategory.options[2]=new Option("Civic");
document.formname.subcategory.options[3]=new Option("Passport");

break;

case "isuzu":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Odyssey");
document.formname.subcategory.options[2]=new Option("Rodeo");

break;

case "jeep":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Cherokee");
document.formname.subcategory.options[2]=new Option("Grand Cherokee");
document.formname.subcategory.options[3]=new Option("Wrangler");

break;

case "lincoln":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Continental");
document.formname.subcategory.options[2]=new Option("Navigator");
document.formname.subcategory.options[3]=new Option("Stratus");
document.formname.subcategory.options[4]=new Option("Town Car");

break;

case "mercedez":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("M Class ML");

case "mercury":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Cougar");
document.formname.subcategory.options[2]=new Option("Grand Marquis");
document.formname.subcategory.options[3]=new Option("Mountaineer");
document.formname.subcategory.options[4]=new Option("Mystique");
document.formname.subcategory.options[5]=new Option("Sable");
document.formname.subcategory.options[6]=new Option("Villager");

break;

case "mitsubishi":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Eclipse");
document.formname.subcategory.options[2]=new Option("Galant");

break;

case "nissan":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("200 SX");
document.formname.subcategory.options[2]=new Option("Altima");
document.formname.subcategory.options[3]=new Option("Maxima");
document.formname.subcategory.options[4]=new Option("Quest");
document.formname.subcategory.options[5]=new Option("Sentra");

case "oldsmobile":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Alero");
document.formname.subcategory.options[2]=new Option("Blazer");
document.formname.subcategory.options[3]=new Option("Cutlass");
document.formname.subcategory.options[4]=new Option("Eighty Eight");
document.formname.subcategory.options[5]=new Option("Silhouette");

break;

case "pontiac":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Boneville");
document.formname.subcategory.options[2]=new Option("Firebird");
document.formname.subcategory.options[3]=new Option("Grand AM");
document.formname.subcategory.options[4]=new Option("Grand Prix");
document.formname.subcategory.options[5]=new Option("Sun Fire");
document.formname.subcategory.options[6]=new Option("Transport");

break;

case "saturn":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Saturn");

break;

case "toyota":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("4 Runner");
document.formname.subcategory.options[2]=new Option("Avalon");
document.formname.subcategory.options[3]=new Option("Camry");
document.formname.subcategory.options[4]=new Option("Corolla");
document.formname.subcategory.options[5]=new Option("Solara");

break;

case "volkswagen":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Jetta");
document.formname.subcategory.options[2]=new Option("New Bettle");
document.formname.subcategory.options[3]=new Option("New Golf");
document.formname.subcategory.options[4]=new Option("New Jetta");
document.formname.subcategory.options[5]=new Option("Passat");

break;

}
return true;
}
</script>
</head>
<title>Dynamic Drop Down List</title>
<body>

<form id="formname" name="formname" method="post" action="submitform.asp" >
<table>
<tr>
<td>Make:</td>
<td><select name="category" id="category" onchange="javascript: dropdownlist(this.options[this.selectedIndex].value);">
<option value="">Select Make</option>
<option value="bmw">BMW</option>
<option value="buick">Buick</option>
<option value="cadillac">Cadillac</option>
<option value="chevrolet">Chevrolet</option>
<option value="chryler">Chrysler</option>
<option value="dodge-plymouth">Dodge-Plymouth</option>
<option value="ford">Ford</option>
<option value="gmc">GMC</option>
<option value="honda">Honda</option>
<option value="isuzu">Isuzu</option>
<option value="lincoln">Lincoln</option>
<option value="mercedez">Mercedez</option>
<option value="mercury">Mercury</option>
<option value="mitsubishi">Mitsubishi</option>
<option value="nissan">Nissan</option>
<option value="oldsmobile">Oldsmobile</option>
<option value="pontiac">Pontiac</option>
<option value="saturn">Saturn</option>
<option value="toyota">Toyota</option>
<option value="volkswagen">Volkswagen</option>
</select></td>
</tr>
<tr>
<td align="right" valign="middle">Model:
</td>
<td align="left" valign="middle"><script type="text/javascript" language="JavaScript">
document.write('<select name="subcategory"><option value="">Select Sub-Category</option></select>')
</script>
<noscript><select name="subcategory" id="subcategory" >
<option value="">Select Model</option>
</select>
</noscript></td>
</tr>
</table>

</form>


</body>
</html>


home2.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>

<link href="index.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="cars.js"></script>
</head>
<body>

<div id="wrapperLeft">
<div id="wrapperRight">
<div id="main">
<div id="columnLeft">
<div id="center"><h3></h3></div>
</div>
<div id="columnRight">
<div id="center"><h3></h3>
</div>
</div>
<div id="columnCenter">
<div id="center">
<form id="carinfo" name="carinfo" method="post"> <!--action="?"-->
<fieldset><legend>Legalization of Autmoibles</legend>
<table>
<tbody>
<tr>
<td>First Name:</td><td><input type="text" name="firstname" maxlength="30"></td>
</tr>
<tr>
<td>Last Name:</td><td><input type="text" name="lastname" maxlength="30"></td>
</tr>
<tr>
<td>Number:</td><td><input type="text" name="number" maxlength="20"></td>
</tr>
<tr>
<td>Email:</td><td><input type="text" name="email" maxlength="35"></td>
</tr>
<tr>
<td>City:</td><td><input type="text" name="city" maxlength="30"></td>
</tr>
<tr>
<td>State:</td><td><select name="state" size="1">
<option selected value=""></option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select></td>
</tr>

<tr><td>Do you have the following:</td></tr>
<tr><td><input type="checkbox" name="mandatory" value="license" /></td><td>Driver's License</td></tr>
<tr><td><input type="checkbox" name="mandatory" value="title" /></td><td>Vehicle Title</td></tr>
<tr><td><input type="checkbox" name="mandatory" value="receipt" /></td><td>Utility Receipt from Mexico showing recieving address</td></tr>
<tr><td><input type="submit" value="Submit" /></td></tr>

<tr><td>Make</td>
<td>
<select name="category" id="category" onchange="javascript: dropdownlist(this.options[this.selectedIndex].value);">
<option value="">Select Make</option>
<option value="bmw">BMW</option>
<option value="buick">Buick</option>
<option value="cadillac">Cadillac</option>
<option value="chevrolet">Chevrolet</option>
<option value="chryler">Chrysler</option>
<option value="dodge-plymouth">Dodge-Plymouth</option>
<option value="ford">Ford</option>
<option value="gmc">GMC</option>
<option value="honda">Honda</option>
<option value="isuzu">Isuzu</option>
<option value="lincoln">Lincoln</option>
<option value="mercedez">Mercedez</option>
<option value="mercury">Mercury</option>
<option value="mitsubishi">Mitsubishi</option>
<option value="nissan">Nissan</option>
<option value="oldsmobile">Oldsmobile</option>
<option value="pontiac">Pontiac</option>
<option value="saturn">Saturn</option>
<option value="toyota">Toyota</option>
<option value="volkswagen">Volkswagen</option>
</select>
</td>
</tr>

<tr>
<td>Model:</td>
<td>
<script type="text/javascript" language="JavaScript">
document.write('<select name="subcategory"><option value="">Select Sub-Category</option></select>')
</script></td>
</fieldset>
</form>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="footer">

</div>
</body>
</html>


--cars.js contained in next post--

drjabo
07-18-2011, 12:21 AM
cars.js


function dropdownlist(list)
{

document.formname.subcategory.options.length=0;
switch (list)
{

case "bmw":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("3 Series");
document.formname.subcategory.options[2]=new Option("5 Series");
document.formname.subcategory.options[3]=new Option("Z Series");

break;

case "buick":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Century");
document.formname.subcategory.options[2]=new Option("Lesabre");
document.formname.subcategory.options[3]=new Option("Park Avenue");
document.formname.subcategory.options[4]=new Option("Regal");
document.formname.subcategory.options[5]=new Option("Riveria");

break;

case "cadillac":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Catera");
document.formname.subcategory.options[2]=new Option("Deville");
document.formname.subcategory.options[3]=new Option("El Dorado");
document.formname.subcategory.options[4]=new Option("Seville");

break

case "chevrolet":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Astro");
document.formname.subcategory.options[2]=new Option("Blazer S 10");
document.formname.subcategory.options[3]=new Option("Camaro");
document.formname.subcategory.options[4]=new Option("Corvette");
document.formname.subcategory.options[5]=new Option("G2500");
document.formname.subcategory.options[6]=new Option("Lumina");
document.formname.subcategory.options[7]=new Option("Malibu");
document.formname.subcategory.options[8]=new Option("Monte Carlo");
document.formname.subcategory.options[9]=new Option("Suburban");
document.formname.subcategory.options[10]=new Option("Tahoe");
document.formname.subcategory.options[11]=new Option("Ventur");

break

case "chrysler":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Town & Country");
document.formname.subcategory.options[2]=new Option("Cirrus");
document.formname.subcategory.options[3]=new Option("Concord");
document.formname.subcategory.options[4]=new Option("Sebring");

break;

case "dodge-plymouth":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Avenger");
document.formname.subcategory.options[2]=new Option("Breeze");
document.formname.subcategory.options[3]=new Option("Caravan Voyager");
document.formname.subcategory.options[4]=new Option("Durango");
document.formname.subcategory.options[5]=new Option("Intrepeid");
document.formname.subcategory.options[6]=new Option("Ram Van 1500");
document.formname.subcategory.options[7]=new Option("Ram Van 2500");


case "ford":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Contour");
document.formname.subcategory.options[2]=new Option("Crown Victoria");
document.formname.subcategory.options[3]=new Option("E150");
document.formname.subcategory.options[4]=new Option("E250");
document.formname.subcategory.options[5]=new Option("E350");
document.formname.subcategory.options[6]=new Option("Escort");
document.formname.subcategory.options[7]=new Option("Expedition");
document.formname.subcategory.options[8]=new Option("Explorer");
document.formname.subcategory.options[9]=new Option("Freestar");
document.formname.subcategory.options[10]=new Option("Mustang");
document.formname.subcategory.options[11]=new Option("Taurus");
document.formname.subcategory.options[12]=new Option("Windstar");

break;

case "gmc":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Jimmy S 15");

break;

case "honda":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Accord");
document.formname.subcategory.options[2]=new Option("Civic");
document.formname.subcategory.options[3]=new Option("Passport");

break;

case "isuzu":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Odyssey");
document.formname.subcategory.options[2]=new Option("Rodeo");

break;

case "jeep":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Cherokee");
document.formname.subcategory.options[2]=new Option("Grand Cherokee");
document.formname.subcategory.options[3]=new Option("Wrangler");

break;

case "lincoln":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Continental");
document.formname.subcategory.options[2]=new Option("Navigator");
document.formname.subcategory.options[3]=new Option("Stratus");
document.formname.subcategory.options[4]=new Option("Town Car");

break;

case "mercedez":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("M Class ML");

case "mercury":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Cougar");
document.formname.subcategory.options[2]=new Option("Grand Marquis");
document.formname.subcategory.options[3]=new Option("Mountaineer");
document.formname.subcategory.options[4]=new Option("Mystique");
document.formname.subcategory.options[5]=new Option("Sable");
document.formname.subcategory.options[6]=new Option("Villager");

break;

case "mitsubishi":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Eclipse");
document.formname.subcategory.options[2]=new Option("Galant");

break;

case "nissan":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("200 SX");
document.formname.subcategory.options[2]=new Option("Altima");
document.formname.subcategory.options[3]=new Option("Maxima");
document.formname.subcategory.options[4]=new Option("Quest");
document.formname.subcategory.options[5]=new Option("Sentra");

case "oldsmobile":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Alero");
document.formname.subcategory.options[2]=new Option("Blazer");
document.formname.subcategory.options[3]=new Option("Cutlass");
document.formname.subcategory.options[4]=new Option("Eighty Eight");
document.formname.subcategory.options[5]=new Option("Silhouette");

break;

case "pontiac":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Boneville");
document.formname.subcategory.options[2]=new Option("Firebird");
document.formname.subcategory.options[3]=new Option("Grand AM");
document.formname.subcategory.options[4]=new Option("Grand Prix");
document.formname.subcategory.options[5]=new Option("Sun Fire");
document.formname.subcategory.options[6]=new Option("Transport");

break;

case "saturn":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Saturn");

break;

case "toyota":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("4 Runner");
document.formname.subcategory.options[2]=new Option("Avalon");
document.formname.subcategory.options[3]=new Option("Camry");
document.formname.subcategory.options[4]=new Option("Corolla");
document.formname.subcategory.options[5]=new Option("Solara");

break;

case "volkswagen":
document.formname.subcategory.options[0]=new Option("Select Model","");
document.formname.subcategory.options[1]=new Option("Jetta");
document.formname.subcategory.options[2]=new Option("New Bettle");
document.formname.subcategory.options[3]=new Option("New Golf");
document.formname.subcategory.options[4]=new Option("New Jetta");
document.formname.subcategory.options[5]=new Option("Passat");

break;

}
return true;
}

vwphillips
07-18-2011, 11:49 AM
new function




function dropdownlist(sel){
var list=sel.value,frm=sel.form;
sel=frm.subcategory;
sel.options.length=0;
sel.options[0]=new Option("Select Model","");
switch (list)
{

case "bmw":

sel.options[1]=new Option("3 Series");
sel.options[2]=new Option("5 Series");
sel.options[3]=new Option("Z Series");

break;

case "buick":

sel.options[1]=new Option("Century");
sel.options[2]=new Option("Lesabre");
sel.options[3]=new Option("Park Avenue");
sel.options[4]=new Option("Regal");
sel.options[5]=new Option("Riveria");

break;

case "cadillac":

sel.options[1]=new Option("Catera");
sel.options[2]=new Option("Deville");
sel.options[3]=new Option("El Dorado");
sel.options[4]=new Option("Seville");

break

case "chevrolet":

sel.options[1]=new Option("Astro");
sel.options[2]=new Option("Blazer S 10");
sel.options[3]=new Option("Camaro");
sel.options[4]=new Option("Corvette");
sel.options[5]=new Option("G2500");
sel.options[6]=new Option("Lumina");
sel.options[7]=new Option("Malibu");
sel.options[8]=new Option("Monte Carlo");
sel.options[9]=new Option("Suburban");
sel.options[10]=new Option("Tahoe");
sel.options[11]=new Option("Ventur");

break

case "chrysler":

sel.options[1]=new Option("Town & Country");
sel.options[2]=new Option("Cirrus");
sel.options[3]=new Option("Concord");
sel.options[4]=new Option("Sebring");

break;

case "dodge-plymouth":

sel.options[1]=new Option("Avenger");
sel.options[2]=new Option("Breeze");
sel.options[3]=new Option("Caravan Voyager");
sel.options[4]=new Option("Durango");
sel.options[5]=new Option("Intrepeid");
sel.options[6]=new Option("Ram Van 1500");
sel.options[7]=new Option("Ram Van 2500");


case "ford":

sel.options[1]=new Option("Contour");
sel.options[2]=new Option("Crown Victoria");
sel.options[3]=new Option("E150");
sel.options[4]=new Option("E250");
sel.options[5]=new Option("E350");
sel.options[6]=new Option("Escort");
sel.options[7]=new Option("Expedition");
sel.options[8]=new Option("Explorer");
sel.options[9]=new Option("Freestar");
sel.options[10]=new Option("Mustang");
sel.options[11]=new Option("Taurus");
sel.options[12]=new Option("Windstar");

break;

case "gmc":

sel.options[1]=new Option("Jimmy S 15");

break;

case "honda":

sel.options[1]=new Option("Accord");
sel.options[2]=new Option("Civic");
sel.options[3]=new Option("Passport");

break;

case "isuzu":

sel.options[1]=new Option("Odyssey");
sel.options[2]=new Option("Rodeo");

break;

case "jeep":

sel.options[1]=new Option("Cherokee");
sel.options[2]=new Option("Grand Cherokee");
sel.options[3]=new Option("Wrangler");

break;

case "lincoln":

sel.options[1]=new Option("Continental");
sel.options[2]=new Option("Navigator");
sel.options[3]=new Option("Stratus");
sel.options[4]=new Option("Town Car");

break;

case "mercedez":

sel.options[1]=new Option("M Class ML");

case "mercury":

sel.options[1]=new Option("Cougar");
sel.options[2]=new Option("Grand Marquis");
sel.options[3]=new Option("Mountaineer");
sel.options[4]=new Option("Mystique");
sel.options[5]=new Option("Sable");
sel.options[6]=new Option("Villager");

break;

case "mitsubishi":

sel.options[1]=new Option("Eclipse");
sel.options[2]=new Option("Galant");

break;

case "nissan":

sel.options[1]=new Option("200 SX");
sel.options[2]=new Option("Altima");
sel.options[3]=new Option("Maxima");
sel.options[4]=new Option("Quest");
sel.options[5]=new Option("Sentra");

case "oldsmobile":

sel.options[1]=new Option("Alero");
sel.options[2]=new Option("Blazer");
sel.options[3]=new Option("Cutlass");
sel.options[4]=new Option("Eighty Eight");
sel.options[5]=new Option("Silhouette");

break;

case "pontiac":

sel.options[1]=new Option("Boneville");
sel.options[2]=new Option("Firebird");
sel.options[3]=new Option("Grand AM");
sel.options[4]=new Option("Grand Prix");
sel.options[5]=new Option("Sun Fire");
sel.options[6]=new Option("Transport");

break;

case "saturn":

sel.options[1]=new Option("Saturn");

break;

case "toyota":

sel.options[1]=new Option("4 Runner");
sel.options[2]=new Option("Avalon");
sel.options[3]=new Option("Camry");
sel.options[4]=new Option("Corolla");
sel.options[5]=new Option("Solara");

break;

case "volkswagen":

sel.options[1]=new Option("Jetta");
sel.options[2]=new Option("New Bettle");
sel.options[3]=new Option("New Golf");
sel.options[4]=new Option("New Jetta");
sel.options[5]=new Option("Passat");

break;

}
return true;
}

call using


<select name="category" id="category" onchange="javascript: dropdownlist(this);">

no need for document.write use


<tr>
<td>Model:</td>
<td>
<select name="subcategory"><option value="">Select Sub-Category</option></select>
</td>

drjabo
07-18-2011, 07:40 PM
Cheers mate!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum