JavaScript codes for Web DEV

JavaScript Dynamic Drop Down Values on Action

If your web pages have a huge list of options to show in the drop down menus (listed into categories), why don't you consider to use this JavaScri... detail at - 2.000+ free JavaScript codes

How to setup

Step 1: Place JavaScript below in your HEAD section
<script type="text/javascript">
// Created by: Sandeep Gangadharan |
// This script downloaded from

function changer(link) {
  if (link=="") {
    return; }

// Edit this portion below. For each new state copy and paste
// the entire IF statement and change the name of the state and the cities.
// Make sure the spelling of the state is the same in the IF statement and in the link.

  if (link=="Arizona") {
    var theOptions=new Array (
      "Deer Valley",
      "Phoenix"); }
  else if (link=="California") {
    var theOptions=new Array (
      "Los Angeles"); }
  else if (link=="Florida") {
    var theOptions=new Array (
      "Altamonte Springs",
      "Boca Raton",
      "West Palm Beach"); }
  else if (link=="New York") {
    document.theForm.theState.value="New York";
    var theOptions=new Array (
      "East Rockaway",
      "New York City"); }

// Do not edit anything below this line:

  i = document.theForm.secondChoice.options.length;
    if (i > 0) {
      document.theForm.secondChoice.options.length -= i; document.theForm.secondChoice.options[i] = null;

  var theCount=0;
  for (e=0; e<theOptions.length; e++) {
    document.theForm.secondChoice.options[theCount] = new Option();
    document.theForm.secondChoice.options[theCount].text = theOptions[e];
    document.theForm.secondChoice.options[theCount].value = theOptions[e];
    theCount=theCount+1; }

//  NOTE: [document.theForm.theState.value] will get you the name of the state,
//  and [document.theForm.secondChoice.value] the name of the city chosen
Step 2: Copy & Paste HTML code below in your BODY section
     This script downloaded from
     Come to view and download over 2000+ free javascript at
<form name=theForm>
  <strong>Select a State:</strong><br>

  <a href="javascript:changer('Arizona')">Arizona</a> | 
  <a href="javascript:changer('California')">California</a> | 
  <a href="javascript:changer('Florida')">Florida</a> | 
  <a href="javascript:changer('New York')">New York</a>
  <strong>Then ...</strong><br>

  <input type="hidden" name="theState">
  <select name="secondChoice">
     <option value="">Select a City</option>

Javascript Music Player - Random Text Generator - Floating Image Script
Quote Originally Posted by Copyright
The Site may provide, or third parties may provide, links to Internet World Wide Web sites or resources. Because has no control over such sites and resources, you acknowledge and agree that is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.