Ziege2k: menübar mit javascript

Beitrag lesen

also das ist mein script aber ich hab keine idee wie du das mit dem window objekt meins!!!

<script type="text/javascript">

self.menuBar="no";

var browser = new Browser();
var activeButton = null;

if (browser.isIE)
  document.onmousedown = pageMousedown;
if (browser.isNS)
  document.addEventListener("mousedown", pageMousedown, true);

function Browser() {

var ua, s, i;

this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

ua = navigator.userAgent;

s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

// Treat any other "Gecko" browser as NS 6.1.

s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

function pageMousedown(event) {

var el;

if (!activeButton)
    return;

if (browser.isIE)
    el = window.event.srcElement;
  if (browser.isNS)
    el = (event.target.className ? event.target : event.target.parentNode);

if (el == activeButton)
    return;

if (el.className != "menuButton"  && el.className != "menuItem" &&
      el.className != "menuItemSep" && el.className != "menu")
    resetButton(activeButton);
}

function buttonClick(button, menuName) {

button.blur();

if (!button.menu)
    button.menu = document.getElementById(menuName);

if (activeButton && activeButton != button)
    resetButton(activeButton);

if (button.isDepressed)
    resetButton(button);
  else
    depressButton(button);

return false;
}

function buttonMouseover(button, menuName) {

if (activeButton && activeButton != button) {
    resetButton(activeButton);
    if (menuName)
      buttonClick(button, menuName);
  }
}

function depressButton(button) {

var w, dw, x, y;

button.className = "menuButtonActive";

if (browser.isIE && !button.menu.firstChild.style.width) {
    w = button.menu.firstChild.offsetWidth;
    button.menu.firstChild.style.width = w + "px";
    dw = button.menu.firstChild.offsetWidth - w;
    w -= dw;
    button.menu.firstChild.style.width = w + "px";
  }

x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button) + button.offsetHeight;
  if (browser.isIE) {
    x += 2;
    y += 2;
  }
  if (browser.isNS && browser.version < 6.1)
    y--;

button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";

button.isDepressed = true;
  activeButton = button;
}

function resetButton(button) {

button.className = "menuButton";

if (button.menu)
    button.menu.style.visibility = "hidden";

button.isDepressed = false;
  activeButton = null;
}

function getPageOffsetLeft(el) {
return el.offsetLeft + (el.offsetParent ? getPageOffsetLeft(el.offsetParent) : 0);
}

function getPageOffsetTop(el) {
return el.offsetTop + (el.offsetParent ? getPageOffsetTop(el.offsetParent) : 0);
}

</script>

<!-- Menubar. -->

<body topmargin="0" bgcolor="#FFFFFF" leftmargin="0">
<div id="menuBar"

<a class="menuButton"

href=""
    onclick="return buttonClick(this, 'auftragmenu');"
    onmouseover="buttonMouseover(this, 'auftragmenu');"

<? print $aufgabenverwaltung_sp; ?></a
<a class="menuButton"

href=""
    onclick="return buttonClick(this, 'terminmenu');"
    onmouseover="buttonMouseover(this, 'terminmenu');"

<? print $terminkal_sp; ?></a
<a class="menuButton"

href=""
    onclick="return buttonClick(this, 'faellmenu');"
    onmouseover="buttonMouseover(this, 'faellmenu');"

<? print $faellig_sp; ?></a
<a class="menuButton"

href=""
    onclick="return buttonClick(this, 'fahrtenmenu');"
    onmouseover="buttonMouseover(this, 'fahrtenmenu');"

<? print $kilomangabe1_sp; ?></a
<a class="menuButton"

href=""
    onclick="return buttonClick(this, 'tourmenu');"
    onmouseover="buttonMouseover(this, 'tourmenu');"

<? print $tourangabe1_sp; ?></a
<a class="menuButton"

href=""
    onclick="return buttonClick(this, 'berichtmenu');"
    onmouseover="buttonMouseover(this, 'berichtmenu');"

<? print $kbericht_sp; ?></a
<a class="menuButton"

href=""
    onclick="return buttonClick(this, 'infomenu');"
    onmouseover="buttonMouseover(this, 'infomenu');"

<? print $infozent_sp; ?></a
</div>

<!-- Tags for the drop down menus. -->

<div id="auftragmenu" class="menu">
<a class="menuItem" href=../auftraege/kundenauswahl.php target=menu><? print $neueaufgabe_sp; ?>
<a class="menuItem" href=../auftraege/wessenaendern.php target=menu><? print $aendernaufg_sp; ?></a>
<div class="menuItemSep"></div>
<a class="menuItem" href=../auftraege/wessenloeschen.php target=menu><? print $loeschaufgabe_sp; ?></a>
<a class="menuItem" href="auftragkontrollemain.html" target=menu><? print $kontrollaufgabe_sp; ?></a>
</div>

<div id="terminmenu" class="menu">
<a class="menuItem" href="../adminmenu/kalender.php" target=menu><? print $ansichtmonat_sp; ?></a>
<a class="menuItem" href="<? print("../termine/woche.php?datum=".$datum."&mitarbeiter=".$mitarbeiter);?>" target=menu><? print $ansichtwoche_sp; ?></a>
<a class="menuItem" href="<? print("../termine/tag.php?datum=".$datum."&mitarbeiter=".$mitarbeiter);?>" target=menu><? print $ansichttag_sp; ?></a>
<div class="menuItemSep"></div>
<a class="menuItem" href="<? print("../termine/neuertermin.php?mitarb=".$mitarbeiter."&datum=".$datum."&uhr=".$uhr);?>" target=menu><? print $neutermin_sp; ?></a>
<a  class="menuItem" href="../urlaub/urlaubeintragen.php?beginnjahr=<? print date("Y",time());?>" target=menu><? print $eintragurlaub_sp; ?></a>
<a class="menuItem" href="../krankheit/krankeintragen_mid.php" target=menu><? print $kranueber_sp; ?></a>
<a class="menuItem" href=../termine/regelauswahl.php?mitarbeiter=<? print($mitarbeiter)?> target=menu><? print $regeltermine_sp; ?></a>
<div class="menuItemSep"></div>
<a class="menuItem" href="../termine/meeting.php" target="menu"><? print $planbesprech_sp; ?></a>
</div>

<div id="faellmenu" class="menu">
<a class="menuItem" href=../auftraege/alarm.php target=menu><? print $faelligsehen_sp; ?></a>
</div>

<div id="fahrtenmenu" class="menu">
<a class="menuItem" href=../fahrten/kilometer.php?mitarbeiter=<? print($mitarbeiter)?> target=menu><? print $kilomangabe2_sp; ?></a>
<a class="menuItem" href=../fahrten/welcheaendern.php?mitarbeiter=<? print($mitarbeiter)?> target=menu><? print $kilomangabe3_sp; ?></a>
</div>

<div id="tourmenu" class="menu">
<a class="menuItem" href=../tour/neuetour.php?mitarbeiter=<? print($mitarbeiter)?> target=menu><? print $tourangabe2_sp; ?></a>
<a class="menuItem" href=../tour/welchenansehen.php?mitarbeiter=<? print($mitarbeiter)?> target=menu><? print $tourangabe3_sp; ?></a>
</div>

<div id="berichtmenu" class="menu">
<a class="menuItem" href=../bericht/neuerbericht.php target=menu><? print $neukbericht_sp; ?></a>
<a class="menuItem" href=../bericht/welchenansehen.php target=menu><? print $sehenkbericht_sp; ?></a>
</div>

<div id="infomenu" class="menu">
<a class="menuItem" href=../kundenblatt/kunden-suche.php target=menu><? print $kundblattdruck_sp; ?></a>
<div class="menuItemSep"></div>
<a class="menuItem" href=../suche/volltextsuche.php target=menu><? print $volltext_sp; ?></a>

</div>