View Full Version : Enable second drop down

01-28-2009, 03:21 AM
Please advise how I can enable the second drop down after the first
drop down selection is selected?

<form name="myname" method="post" action="mypage.jsp">
<select name = "Movie">
<option value = "">Select One</option>
<option value = "I am Legend">I am Legend</option>
<option value = "Wedding Crashers">Wedding Crashers</option>
<option value = "Jaws">Jaws</option>

<select name = "Television" disable="disable">
<option value = "">Select One</option>
<option value = "CSI">CSI</option>
<option value = "Amercian Idol">American Idol</option>
<option value = "60 Minutes">60 Minutes</option>

01-28-2009, 03:34 AM
have your select one option set to be automatically selected. give it an on change event and enable the other "SELECT" as long as Movies value is not equal to ""

01-28-2009, 10:52 PM
I use this script...
you can see it here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
#dynamic {
border: 1px;
padding: 3px 20px 20px 20px;
margin-top: 0;
color: #000;
background-color: #FFFFCC;
width: 400px;

.style2 {
font-size: x-large;
font-weight: bold;
.style20 {color: #333333;
font-size: 12px;
font-weight: bold;

<script langauge="javascript">
team = new Array(
new Array(new Array(""), new Array("Internet Marketing"), new Array("Signage Systems"), new Array("Banners"), new Array("Promotional Products")

new Array(new Array(""), new Array("Pottery")

new Array(new Array(""), new Array("Automotive Service & Repair/Oil Change"), new Array("Car Wash/Detailing Service"), new Array("Tire Stores"), new Array("Transmission Centers")

new Array(new Array(""), new Array("Day Spa"), new Array("Dentists"), new Array("Nail Salons"), new Array("Tanning")

new Array(new Array(""), new Array("Team Building"), new Array("Website Design")

new Array(new Array(""), new Array("Air Duct Cleaning"), new Array("Carpet/Upholstery Cleaning"), new Array("Cleaning/Maid Services")

new Array(new Array(""), new Array("Alterations"), new Array("Consignment"), new Array("Dry Cleaning"), new Array("Women's Plus Sizes")

new Array(new Array(""), new Array("Computer Sales and Repair")

new Array(new Array(""), new Array("Convenience Stores")

new Array(new Array(""), new Array("Advance"), new Array("Mocksville")

new Array(new Array(""), new Array("Movie & Game Rentals")

new Array(new Array(""), new Array("Family Fun"), new Array("Laser Tag"), new Array("Paint Your Own Pottery"), new Array("Parks & Recreation"), new Array("Video Gaming Centers")

new Array(new Array(""), new Array("Convenience Stores")

new Array(new Array(""), new Array("Chiropractor"), new Array("Dentists"), new Array("Health and Fitness"), new Array("Massage Therapy"), new Array("Urgent Care Facilities"), new Array("Weight Loss")

new Array(new Array(""), new Array("Air Conditioning/Heating"), new Array("Curbing & Walkways"), new Array("Flooring/Tile"), new Array("Garage Door Sales & Repair"), new Array("Grout Cleaning"), new Array("Gutter Cleaning"), new Array("Home Organization/Maintenance and Repair"), new Array("Mold Remediation"), new Array("Movers"), new Array("Moving Truck Rentals"), new Array("Painting"), new Array("Pest Control"), new Array("Plumbing "), new Array("Pressure Washing"), new Array("Roofing"), new Array("Self/Portable Storage"), new Array("Sprinkler Systems"), new Array("Windows/Vinyl Siding"), new Array("Wood Repair")

new Array(new Array(""), new Array("Automobile Insurance"), new Array("Health Insurance"), new Array("Life Insurance")

new Array(new Array(""), new Array("Gutter Cleaning"), new Array("Landscaping Contractors/Lawn Care"), new Array("Mulch"), new Array("Pest Control"), new Array("Sprinkler Systems"), new Array("Kudzu Removal"), new Array("Tree/Stump Removal")

new Array(new Array(""), new Array("Chiropractor"), new Array("Dentistry")

new Array(new Array(""), new Array("Pet Groomers"), new Array("Veterinarian")

new Array(new Array(""), new Array("File/Inventory Storage"), new Array("Personal/Seasonal Services"), new Array("Wedding Planning"), new Array("Website Design")

new Array(new Array(""), new Array("Residential Homes"), new Array("Rental Property Management")

new Array(new Array(""), new Array("All Restaurants"), new Array("Asian Cusine"), new Array("Bakeries"), new Array("Banquet Facilities"), new Array("Bars & Nightlife"), new Array("Catering"), new Array("Chinese Cusine"), new Array("Coffee Shops"), new Array("Family Restaurant"), new Array("Fast/Casual Dining"), new Array("Fine Dining"), new Array("Greek Cusine"), new Array("Italian Cusine"), new Array("Japanese Cusine"),new Array("Meal Preperation"), new Array("Mexican Cusine"), new Array("Organic Foods"), new Array("Pizzerias"), new Array("Seafood"), new Array("Sports Bars"), new Array("Subs & Sandwiches"), new Array("Thai Cusine"), new Array("Vegetarian"), new Array("Vietnamese")

new Array(new Array(""), new Array("Arts and Crafts"), new Array("Clothing"), new Array("Florists"), new Array("Movers/Moving Supplies")

new Array(new Array(""), new Array("Bowling"), new Array("Golf Lessons"), new Array("Driving Range"), new Array("Go Kart Racing"), new Array("Golf Equipment, Apparel & Supplies"), new Array("Golf/Miniature Golf Courses"), new Array("Hockey Equipment & Supplies"), new Array("Ice Skating/Hockey"), new Array("Sporting Goods")

new Array(new Array(""), new Array("Personal Taxes")

new Array(new Array(""), new Array("Cruises"), new Array("Honeymoons"), new Array("Tours/Land Packages")

new Array("")


function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {

var i, j;

var prompt;

// empty existing items

for (i = selectCtrl.options.length; i >= 0; i--) {

selectCtrl.options[i] = null;


prompt = (itemArray != null) ? goodPrompt : badPrompt;

if (prompt == null) {

j = 0;


else {

selectCtrl.options[0] = new Option(prompt);

j = 1;


if (itemArray != null) {

// add new items

for (i = 0; i < itemArray.length; i++) {

selectCtrl.options[j] = new Option(itemArray[i][0]);

if (itemArray[i][1] != null) {

selectCtrl.options[j].value = itemArray[i][1];




// select first item (prompt) for sub list

selectCtrl.options[0].selected = true;



// End -->


<table border="0" align="center" cellspacing="0" bgcolor="#CCCCCC">
<td><form action="http://www.surf2saveinc.com/cgi-bin/coupons.pl" method="post" name="input" id="input" >
<table border="0" bgcolor="#CCCCCC">

<td valign="top">Category(s):</td>
<td valign="top"><span class="style20">
<select name="catlist" size="10" multiple="multiple" onchange="fillSelectFromArray(this.form.subcat, ((this.selectedIndex == -1) ? null : team[this.selectedIndex-1]))">
<option>Arts and Crafts</option>
<option>Beauty Services</option>
<option>Business Services</option>
<option>Cleaning Services</option>
<option>Convenience Stores</option>
<option>DAVIE County</option>
<option>Family Fun/Children Activities</option>
<option>Gas Stations</option>
<option>Health and Fitness</option>
<option>Home Improvements and Repairs</option>
<option>Medical Services</option>
<option>Professional Services</option>
<option>Real Estate</option>
<option>Restaurants and Food</option>
<option>Sports and Sporting Goods</option>
<option>Tax Preparation</option>
<td width="2" valign="top" bgcolor="#333333">&nbsp;</td>
<td valign="top">Subcategory(s):</td>
<td valign="top"><span class="style20">
<select name="subcat" size="10" multiple="multiple">