草鞋

          Blog grass shoes
          posts - 1, comments - 4, trackbacks - 0, articles - 27
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          JS菜單

          Posted on 2007-10-23 09:42 草 鞋 閱讀(202) 評論(0)  編輯  收藏 所屬分類: JavaScript

          <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
          <title>菜單</title>
          <style>
          .menu_table {background-color: #ffffff; color: #000000; border: 1 solid #717685;}
          .menu_td_on {background-color: #CFD7EA; border: 1 solid #717685; color: #000000; cursor: hand; font-size: 9pt; text-indent: 10;  width: 70; height: 18}
          .menu_td_off {background-color: #ffffff; border: 1 solid  #ffffff; color: #000000 cursor: hand; font-size: 9pt;  text-indent: 10;  width: 70; height: 18}
          </style>
          </head>
          <body bgcolor="#D0DCE0" align="center">
          <br><br>
          <script>
          <!--
          //-------------  Menu Action ----------------//
          function off_td()
          {
          event.srcElement.className = "menu_td_off";
          }
          function on_td()
          {
          event.srcElement.className = "menu_td_on";
          }

          var time_num = new Array();
          var temp_num = null;
          function parent_show_son(num,l,t,w)
          {
          clearTimeout(time_num[num]);
          if(temp_num)
          {
            hide_son(temp_num);
          }

          with(document.getElementById("son_"+num).style)
          {
            pixelLeft = 1+w+10;
            pixelTop  = t+15;
            display = "block";
          }

          temp_num = num;
          }
          function parent_hide_son(num)
          {
          time_num[num] = setTimeout("hide_son("+num+")",600);
          }
          function hide_son(num)
          {
          document.getElementById("son_"+num).style.display = "none";
          }
          function son_on(num)
          {
          clearTimeout(time_num[num]);
          }
          //-------------- Make   Menu --------------//
          var parent_char = '<table border="0" cellspacing="1" cellpadding="0" class="menu_table">'
          var son_num = 0;
          var son_menu = new Array();

          function Have_menu(word)
          {
            parent_char+='<tr><td class="menu_td_off"  onmousemove="on_td();parent_show_son(this.son,this.offsetLeft,this.offsetTop,this.offsetWidth)" onmouseout="off_td();parent_hide_son(this.son)" son="'+son_num+'">'+word+'</td></tr>';
           
            son_menu[son_num] = '<div id="son_'+son_num+'" style="position: absolute; top: 0; left: 0; display: none" son="'+son_num+'" onmouseover="son_on(this.son)" onmouseout="parent_hide_son(this.son)"><table border="0" cellspacing="1" cellpadding="0" class="menu_table">'
           
            this.son = son_num;
            this.Additem = Additem;
            this.Enditem = Enditem;
            son_num++;
          }

          function Additem(word,link,target)
          {
            son_menu[this.son]+= '<tr><a href="'+link+'" target="'+target+'"><td  class="menu_td_off"  onmousemove="on_td()" onmouseout="off_td()">'+word+'</td></a></tr>'
          }

          function Enditem()
          {
            son_menu[this.son]+= '</table></div>'
          }

          function No_menu(word,link,target)
          {
            parent_char+='<tr><a href="'+link+'" target="'+target+'">gg<td  class="menu_td_off"  onmousemove="on_td()" onmouseout="off_td()">'+word+'</td></a></tr>';
          }

          function End_menu()
          {
            parent_char+='</table>';
           
            for(i=0;i<son_menu.length;i++)
            {
             parent_char+=son_menu[i]
            
            }
          }


          function Show_Good_Menu()
          {
            return parent_char;
          }

          //-->
          </script>
          <script>
          <!--
          var BM = new Array();

          BM[0] = new Have_menu("父菜單一");

            BM[0].Additem("子菜單一","#","main");
            BM[0].Additem("子菜單一","#","main");
            BM[0].Additem("子菜單一","#","main"); 
            BM[0].Enditem();
          BM[1] = new Have_menu("父菜單二");

            BM[1].Additem("子菜單一","/worker/legend_user","main");
            BM[1].Additem("子菜單一","/worker/legend_user/add.php","main");
            BM[1].Additem("子菜單一","#","main"); 
            BM[1].Enditem(); 
          BM[2] = new No_menu("父菜單三","/worker/add.php","main");

          BM[3] = new No_menu("父菜單四","/worker/mysql","_blank");

          End_menu();

          document.body.innerHTML += Show_Good_Menu();
          //-->
          </script>
          </body>
          </html>

          主站蜘蛛池模板: 佛教| 昭通市| 巴林右旗| 治多县| 甘肃省| 朝阳县| 遵义市| 额尔古纳市| 武川县| 和平县| 安西县| 永吉县| 乐平市| 武冈市| 雷州市| 灵台县| 普洱| 宜宾市| 阜康市| 中山市| 鄂州市| 灵山县| 西乌珠穆沁旗| 长汀县| 长治县| 榆林市| 错那县| 池州市| 科尔| 民权县| 陵川县| 普格县| 满城县| 封丘县| 聂拉木县| 徐州市| 安吉县| 鹤峰县| 合阳县| 应用必备| 无棣县|