可以做到:
如:
<script language="JavaScript">
<!--
var subcat = new Array();
<?
$tt="";
$sql68="select distinct city from bschool";
$result68=mysql_query($sql68);
$j=0;
while ($n=mysql_fetch_array($result68)) {
$sql69="select distinct county from bschool where city='$n[city]' and county!='$tt'";
$result69=mysql_query($sql69);
while ($n1=mysql_fetch_array($result69)) {
?>
subcat[<? echo $j; ?>] = new Array("<? echo $n1[county]; ?>","<? echo $n[city]; ?>","<? echo $n1[county]; ?>");
<?
$j=$j+1;
}
//$i=$i+1;
}
?>
</script>
如:
<script language="JavaScript">
<!--
var subcat = new Array();
<?
$tt="";
$sql68="select distinct city from bschool";
$result68=mysql_query($sql68);
$j=0;
while ($n=mysql_fetch_array($result68)) {
$sql69="select distinct county from bschool where city='$n[city]' and county!='$tt'";
$result69=mysql_query($sql69);
while ($n1=mysql_fetch_array($result69)) {
?>
subcat[<? echo $j; ?>] = new Array("<? echo $n1[county]; ?>","<? echo $n[city]; ?>","<? echo $n1[county]; ?>");
<?
$j=$j+1;
}
//$i=$i+1;
}
?>
</script>
<script type='text/javascript'>
//下一行更改腳本中的內容.
document.all.aaa.innerHTML="<script>...</script>";
</script>
這种方法我也沒試過,試一下,成功別忘給分.