|
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>:::回复您的多级菜单的内容:::</title>
- <SCRIPT LANGUAGE="JavaScript">
- <!--
- function Dsy()
- {
- this.Items = {};
- }
- Dsy.prototype.add = function(id,iArray)
- {
- this.Items[id] = iArray;
- }
- Dsy.prototype.Exists = function(id)
- {
- if(typeof(this.Items[id]) == "undefined") return false;
- return true;
- }
- function change(v){
- var str="0";
- for(i=0;i<v;i++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1));};
- var ss=document.getElementById(s[v]);
- with(ss){
- length = 0;
- options[0]=new Option(opt0[v],opt0[v]);
- if(v && document.getElementById(s[v-1]).selectedIndex>0 || !v)
- {
- if(dsy.Exists(str)){
- ar = dsy.Items[str];
- for(i=0;i<ar.length;i++)options[length]=new Option(ar[i],ar[i]);
- if(v)options[1].selected = true;
- }
- }
- if(++v<s.length){change(v);}
- }
- }
- var dsy = new Dsy();
- //第一级
- dsy.add("0",["1","2","3"]);
- //第二级
- dsy.add("0_0",["a","b","c"]);
- dsy.add("0_1",["e","f","g"]);
- dsy.add("0_2",["h","i","j"]);
- //-->
- </SCRIPT>
- <SCRIPT LANGUAGE = JavaScript>
- var s=["s1","s2"];
- var opt0 = ["第一级","第二级"];
- function setup()
- {
- for(i=0;i<s.length-1;i++)
- document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")");
- change(0);
- }
- //-->
- </SCRIPT>
- </head>
- <body bgcolor="#6699cc" onload="setup()" >
- <p>
- </p>
- <p align="center"><font size="2">第一级
- <select name="11111" id="s1">
- <option>第一级</option>
- </select>第二级
- <select name="22222" id="s2">
- <option>第二级</option>
- </select>
- </font></p>
- <tr><td width="100%" height="65"><p><span class="style8"><font size="2"><span class="style6"> </span></font></span><span class="style3">
- </span></p></td>
- </tr>
- </body>
- </html>
复制代码 |
|