关联查询.给你一段我以前写的代码,你可以看看<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var arrItems1 = new Array();
var arrItemsGrp1 = new Array();
<?
mobile_info_list();//调用php查询函数
?>
function selectChange(control, controlToPopulate, ItemArray, GroupArray)
{
  var myEle ;
  var x ;
  for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
  if (control.name == "firstChoice") {
 }
  myEle = document.createElement("option") ;
  myEle.value = 0 ;
  myEle.text = "&Ccedil;&euml;&Ntilde;&iexcl;&Ocirc;&ntilde;&Ecirc;&Ouml;&raquo;ú&ETH;&Iacute;&ordm;&Aring;" ;
  controlToPopulate.add(myEle) ;
for ( x = 0 ; x < ItemArray.length  ; x++ )
    {
      if ( GroupArray[x] == control.value )
        {
          myEle = document.createElement("option") ;
          myEle.value = x ;
          myEle.text = ItemArray[x] ;
          controlToPopulate.add(myEle) ;
        }
    }
}
//  End -->
</script>
<form name=myChoices action="" method="post" onSubmit="return checkform_sort();">
<tr><td bgcolor="#dddddd" class="title_black" colspan=4>&Igrave;í&frac14;&Oacute;&ETH;&Aring;&Iuml;&cent;</td></tr>
<tr align="left"> 
<td width="20%">&Ecirc;&Ouml;&raquo;ú&AElig;·&Aring;&AElig;:</td>
<td width="30%"><SELECT id=firstChoice name=firstChoice onchange="selectChange(this, myChoices.secondChoice, arrItems1, arrItemsGrp1);"><option value=0>&Ccedil;&euml;&Ntilde;&iexcl;&Ocirc;&ntilde;&Ecirc;&Ouml;&raquo;ú&AElig;·&Aring;&AElig;</option><?
mobile_sort_list();
?></select></td>
<td width="20%">&Ecirc;&Ouml;&raquo;ú&ETH;&Iacute;&ordm;&Aring;:</td>
<td width="30%"><SELECT id=secondChoice name=secondChoice>
</SELECT>
</form>