How can you show a child list based on the selection in a parent list?


<- Choose a country
(parent element already selected with child showing)

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

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005-2010 Roderick Divilbiss">
<script language="javascript" type="text/javascript">
<!--
// The child selects
var noSelect = '<- Choose a country';
var usaSelect = '<select size="1" name="state"><option>State 1</option><option>State 2</option><option>State 3</option></select>';
var englandSelect = '<select size="1" name="state"><option>Shire 1</option><option>Shire 2</option><option>Shire 3</option><option>Shire 4</option><option>Shire 5</option><option>Shire 6</option></select>';
var mexicoSelect = '<select size="1" name="state"><option>Estado 1</option><option>Estado 2</option><option>Estado 3</option><option>Estado 4</option></select>';

// The changing function
function changeCountry(oSel) {
    document.getElementById('childSelectDivide').innerHTML = eval(oSel[oSel.selectedIndex].value+'Select');
}
//-->
</script>

<title>Country Info</title>
</head>

<!--Shouldn't use tables for layout but it will do for this example-->
<table border="0" cellpadding="0" style="border-collapse: collapse" width="600">
<tr>
  <td width="100">
    <select name="country" onchange="changeCountry(this);" size="1">
      <option value="no" selected>Select</option>
      <option value="usa">USA</option>
      <option value="england">England</option>
      <option value="mexico">Mexico</option>
     </select>
  </td>
  <td width="500" valign="top">
    <div id="childSelectDivide">&lt;- Choose a country</div>
  </td>
</tr>
</table>
</body>

</html>


This Weeks Most Popular Pages Newest Pages