PHP Tutorial + Web effects to achieve the three-level linkage menu
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>insert title here</title>
<script type= "Text/javascript" >
<!--
var prov = data.province;
var city = data.city;
var area = Data.area;
function Change (v)
{
var str = 0;
var val = 0;
if (v>0)
{
OBJ = document.getElementById (' s ' +v);
val = obj.options[obj.selectedindex].value;
}
var obj = document.getElementById (S[v]);
With (obj)
{
length = 0;
Options[0] = new Option (Opt0[v],opt0[v]);
var $arr = get (V,val);
for (var key in arr)
{
Options[length] = new Option (Arr[key],key);
if (v && options[1]) options[1].selected = true;
if (++v < s.length) Change (v);
}
}
}
function Get (index, Val)
{
var value = "";
if (index = = 0)
{
value = Prov;
}else if (index = = 1) {
value = City;
}else if (index = = 2) {
Value = Area;
}
var t = new Array ();
if (val = 0)
{
return value;
}else {
For (var k in value)
if (k.substr (0,val.length) = val)
{
T[K] = value[k];
}
return $t;
}
}
var s = ["S1", "S2", "S3"];
var opt0 = ["-Select-Provinces-", "-select-City-", "-select-urban-"];
function Setup ()
{
For ($i =0 $i <s.length-1; $i + +)
{
document.getElementById (S[i]). onchange = new Function ("Change (" + (i+1) +) ");
Change (0);
}
}
-->
</script>
<body onload= "setup ();" >
<select id= "S1" ><option>-choice-Provinces and cities-</option></select>
<select id= "S2" ><option>-choice-City-</option></select>
<select id= "S3" ><option>-choice-Urban-</option></select>
</body>