三级的,不过是以前繁体环境下写的。。
<?
mysql_connect("localhost","root","144444");
$sql="select floor,computerdas,station_name from cidtolid,stationinfo where lineno=line_id";$query=mysql_db_query("dassys",$sql);function getdesc($strdesc){
$pos1=strchr($strdesc,'>');
$pos1=substr($pos1,1,(strlen($pos1)-5));
return $pos1;
}
?>
<HTML>
<HEAD>
<link href='../inc/common.css' rel='stylesheet' type='text/css'>
<title>Techo Web DAS </title>
<meta http-equiv="Content-Type" content="text/html; charset=big5"><script LANGUAGE=javascript>
PO=new Array();
index=0;
function init()
{
}
</script>
</HEAD>
<body>
<!--<div align="center"><FONT align=center class=infoHeader>Select Station of Line </FONT> <br><br></div>--><TABLE class=table_wj border=1 align=center width=80% bordercolor="#10B487">
<tr>
<form name=f1 onload="init()" action="">
<td>©Ò¦b¼Ó¼h</td>
<td>
<select class="instyle_sele" name=floor onchange="chg(f1.floor,f1.line_id,0)">
<option value="">--Please select--</option>
<option value="all">--All--</option>
<?
$index=0;
while ($myrow=mysql_fetch_row($query))
{ ?>
<script>
PO[<?echo $index;?>]=new Array(3);
PO[<?echo $index;?>][0]="<?echo $myrow[0];?>";
PO[<?echo $index;?>][1]="<?echo $myrow[1];?>";
PO[<?echo $index;?>][2]="<?echo $myrow[2];?>";
var i;
exists=false;
for(i=2;i<f1.floor.length;i++)
if(f1.floor.options[i].text==PO[<?echo $index;?>][0])
{
exists=true;
break;
}
if (!exists)
{
f1.floor.length++;
f1.floor.options[f1.floor.length-1].text=PO[<?echo $index;?>][0];
}
</SCRIPT>
<?
$index+=1;
}
?>
</select> </td>
<td>¥Í²£½u§O</td>
<td><select class="instyle_sele" NAME=line_id onchange="chg0(f1.floor,f1.line_id,f1.station_id,1)">
<option value=''>--Please Select--</option>
<option value="all">--All--</option>
</select></td>
<td>¤u¦ì¦WºÙ</td>
<td><select class="instyle_sele" NAME=station_id >
<option value=''>--Please Select--</option>
<option value="all">--All--</option>
</select></td>
<td><input type=submit name=sub VALUE=go class=button></td></form></tr>
</TABLE><hr ><script>
function chg(p1,p2,pIndex)
{
//alert(p1.options[p1.selectedIndex].text);
p2.length=2;
for(i=0;i<<?echo $index;?>;i++)
{
exists=false;
for(j=0;j<p2.options.length;j++)
if((p2.options[j].text==PO[i][pIndex+1])||(PO[i][pIndex]!=p1.options[p1.selectedIndex].text))
{
exists=true;
break;
}
if (!exists)
{
p2.length++;
p2.options[p2.length-1].text=PO[i][pIndex+1];
}
}
}function chg0(p0,p1,p2,pIndex)
{
//alert(p1.options[p1.selectedIndex].text);
p2.length=2;
for(i=0;i<<?echo $index;?>;i++)
{
exists=false;
for(j=0;j<p2.options.length;j++)
if((p2.options[j].text==PO[i][pIndex+1])||(PO[i][pIndex]!=p1.options[p1.selectedIndex].text)||(PO[i][pIndex-1]!=p0.options[p0.selectedIndex].text))
{
exists=true;
break;
} if (!exists)
{
p2.length++;
p2.options[p2.length-1].text=PO[i][pIndex+1];
} }
}
</script><!--main prg-->
<?
mysql_connect("localhost","root","144444");
$sql="select floor,computerdas,station_name from cidtolid,stationinfo where lineno=line_id";$query=mysql_db_query("dassys",$sql);function getdesc($strdesc){
$pos1=strchr($strdesc,'>');
$pos1=substr($pos1,1,(strlen($pos1)-5));
return $pos1;
}
?>
<HTML>
<HEAD>
<link href='../inc/common.css' rel='stylesheet' type='text/css'>
<title>Techo Web DAS </title>
<meta http-equiv="Content-Type" content="text/html; charset=big5"><script LANGUAGE=javascript>
PO=new Array();
index=0;
function init()
{
}
</script>
</HEAD>
<body>
<!--<div align="center"><FONT align=center class=infoHeader>Select Station of Line </FONT> <br><br></div>--><TABLE class=table_wj border=1 align=center width=80% bordercolor="#10B487">
<tr>
<form name=f1 onload="init()" action="">
<td>©Ò¦b¼Ó¼h</td>
<td>
<select class="instyle_sele" name=floor onchange="chg(f1.floor,f1.line_id,0)">
<option value="">--Please select--</option>
<option value="all">--All--</option>
<?
$index=0;
while ($myrow=mysql_fetch_row($query))
{ ?>
<script>
PO[<?echo $index;?>]=new Array(3);
PO[<?echo $index;?>][0]="<?echo $myrow[0];?>";
PO[<?echo $index;?>][1]="<?echo $myrow[1];?>";
PO[<?echo $index;?>][2]="<?echo $myrow[2];?>";
var i;
exists=false;
for(i=2;i<f1.floor.length;i++)
if(f1.floor.options[i].text==PO[<?echo $index;?>][0])
{
exists=true;
break;
}
if (!exists)
{
f1.floor.length++;
f1.floor.options[f1.floor.length-1].text=PO[<?echo $index;?>][0];
}
</SCRIPT>
<?
$index+=1;
}
?>
</select> </td>
<td>¥Í²£½u§O</td>
<td><select class="instyle_sele" NAME=line_id onchange="chg0(f1.floor,f1.line_id,f1.station_id,1)">
<option value=''>--Please Select--</option>
<option value="all">--All--</option>
</select></td>
<td>¤u¦ì¦WºÙ</td>
<td><select class="instyle_sele" NAME=station_id >
<option value=''>--Please Select--</option>
<option value="all">--All--</option>
</select></td>
<td><input type=submit name=sub VALUE=go class=button></td></form></tr>
</TABLE><hr ><script>
function chg(p1,p2,pIndex)
{
//alert(p1.options[p1.selectedIndex].text);
p2.length=2;
for(i=0;i<<?echo $index;?>;i++)
{
exists=false;
for(j=0;j<p2.options.length;j++)
if((p2.options[j].text==PO[i][pIndex+1])||(PO[i][pIndex]!=p1.options[p1.selectedIndex].text))
{
exists=true;
break;
}
if (!exists)
{
p2.length++;
p2.options[p2.length-1].text=PO[i][pIndex+1];
}
}
}function chg0(p0,p1,p2,pIndex)
{
//alert(p1.options[p1.selectedIndex].text);
p2.length=2;
for(i=0;i<<?echo $index;?>;i++)
{
exists=false;
for(j=0;j<p2.options.length;j++)
if((p2.options[j].text==PO[i][pIndex+1])||(PO[i][pIndex]!=p1.options[p1.selectedIndex].text)||(PO[i][pIndex-1]!=p0.options[p0.selectedIndex].text))
{
exists=true;
break;
} if (!exists)
{
p2.length++;
p2.options[p2.length-1].text=PO[i][pIndex+1];
} }
}
</script><!--main prg-->
http://www.csdn.net/expert/topic/873/873963.xml?temp=.4158594將我的mysql數據庫備份程序看懂了,你就會了
还可以参见:
http://www.csdn.net/expert/topic/663/663860.xml?temp=.8519098
那是一次性取出所有的數據到js數組中.如果數據量大了,就不要用那種方法
可以用iframe,xmlhttp等技術來實現。
<?
include("config.php");
$sql="select * from cus_filetype where departid='$cus'";
$rel=mysql_query($sql);
echo "<script>\n
var obj=top.document.forms[0].filetype;\n
obj.length=1;
";
$n=1;
while($r=mysql_fetch_array($rel)){
echo "obj.length=$n+1;\n";
echo "obj[$n].value='".$r[typeid]."';\n
obj[$n].text='".$r[type]."';";
$n++;
}
echo "</script>";
?>
前两个月,我也有同样的问题,很简单的,只要使用一下javascript就可以得到了!
[email protected]