menu.js
上传用户:luoweizhao
上传日期:2021-11-29
资源大小:15269k
文件大小:2k
源码类别:

OA系统

开发平台:

ASP/ASPX

  1. NS4 = (document.layers) ? 1 : 0;
  2. IE4 = (document.all) ? 1 : 0;
  3. ver4 = (NS4 || IE4) ? 1 : 0;
  4. if (ver4) {
  5.     with (document) {
  6.         write("<STYLE TYPE='text/css'>");
  7.         if (NS4) {
  8.             write(".parent {position:absolute; visibility:visible}");
  9.             write(".child {position:absolute; visibility:visible}");
  10.             write(".regular {position:absolute; visibility:visible}")
  11.         }
  12.         else {
  13.             write(".child {display:none}")
  14.         }
  15.         write("</STYLE>");
  16.     }
  17. }
  18. function getIndex(el) {
  19.     ind = null;
  20.     for (i=0; i<document.layers.length; i++) {
  21.         whichEl = document.layers[i];
  22.         if (whichEl.id == el) {
  23.             ind = i;
  24.             break;
  25.         }
  26.     }
  27.     return ind;
  28. }
  29. function arrange() {
  30.     nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
  31.     for (i=firstInd+1; i<document.layers.length; i++) {
  32.         whichEl = document.layers[i];
  33.         if (whichEl.visibility != "hide") {
  34.             whichEl.pageY = nextY;
  35.             nextY += whichEl.document.height;
  36.         }
  37.     }
  38. }
  39. function initIt(){
  40.     if (!ver4) return;
  41.     if (NS4) {
  42.         for (i=0; i<document.layers.length; i++) {
  43.             whichEl = document.layers[i];
  44.             if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
  45.        }
  46.         arrange();
  47.     }
  48.     else {
  49.         divColl = document.all.tags("DIV");
  50.         for (i=0; i<divColl.length; i++) {
  51.             whichEl = divColl(i);
  52.             if (whichEl.className == "child") whichEl.style.display = "none";
  53.         }
  54.     }
  55. }
  56. function expandIt(el) {
  57.     if (!ver4) return;
  58.     if (IE4) {
  59.         whichEl = eval(el + "Child");
  60.         if (whichEl.style.display == "none") {
  61.             whichEl.style.display = "block";
  62.         }
  63.         else {
  64.             whichEl.style.display = "none";
  65.         }
  66.     }
  67.     else {
  68.         whichEl = eval("document." + el + "Child");
  69.         if (whichEl.visibility == "hide") {
  70.             whichEl.visibility = "show";
  71.         }
  72.         else {
  73.             whichEl.visibility = "hide";
  74.         }
  75.         arrange();
  76.     }
  77. }
  78. onload = initIt;