Op deze website gebruiken we cookies om content en advertenties te personaliseren, om functies voor social media te bieden en om ons websiteverkeer te analyseren. Ook delen we informatie over uw gebruik van onze site met onze partners voor social media, adverteren en analyse. Deze partners kunnen deze gegevens combineren met andere informatie die u aan ze heeft verstrekt of die ze hebben verzameld op basis van uw gebruik van hun services. Meer informatie.

Akkoord

Vraag & Antwoord

Webprogrammeren & scripting

menu op vekeerde plek in site

boelieboelie
7 antwoorden
  • hallo,

    Op mijn site www.fczwolleteam.nl heb ik een menubalkje.Aleen deze staat op de verkeerde positie.Mijn vraag is dan ook hoe kan ik zon menutje op de rode plek in mijn site krijgen.Moet je dat aanpassen in mijn script?Want ik moest dit scriptje tussen mijn head zetten:

    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="menu/menu_array.js"></SCRIPT>
    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="menu/mmenu.js"></SCRIPT>

    Ik hoop dat u me dat kan vertelle.
    Ik werk met dreamwever.

    TvSchendel
  • Dit kan met CSS: margin
  • Hallo,

    Ik zit nu met het volgende probleem:
    Op www.fczwolleteam.nl heb ik ff een menutje gemaakt.
    Als je vervolgens op FC Zwolle C1 drukt verschijnt het submenutje helemaal rechts in de pagina.
    Bij de andere zoals competitie gaat het wel goed.

    Hierbij mijn scripts zodat u hopelijk de fout deruit kan halen:

    Tussen man head:

    [code:1:5a3d3e4a75]<style type="text/css">
    /* Deze stylesheet bepaalt het uitzicht van de menubalk */
    /* Dit kun je evt.wijzigen : andere kleuren, ander lettertype, … */

    /* Het uitzicht van het gebruikte lettertype op de menubalk */
    div.WinBalk,
    div.WinBalk a.WinKnop,
    div.menu,
    div.menu a.WinItem {
    font-family: "MS Sans Serif", Arial, sans-serif;
    font-size: 8pt;
    font-style: normal;
    font-weight: normal;
    color: black; }
    /* De achtergrondkleur van de bovenste menubalk */
    div.WinBalk {
    background-color: #FF0000;
    border: 2px solid;
    border-color: #FFFFFF #FFFFFF #FFFFFF #FFFFFF;
    padding: 4px 2px 4px 2px;
    text-align: left;}
    /* De 'normale' kleur van de tekst op de bovenste menubalk */
    div.WinBalk a.WinKnop {
    background-color: transparent;
    border: 1px solid #FF0000;
    color: #000000;
    cursor: default;
    left: 0px;
    margin: 1px;
    padding: 2px 6px 2px 6px;
    position: relative;
    text-decoration: none;
    top: 0px;
    z-index: 100;}
    /* De kleur bij muisover van de tekst op de bovenste menubalk */
    div.WinBalk a.WinKnop:hover {
    background-color: transparent;
    border-color: #FF0000 #FF0000 #FF0000 #FF0000;
    color: #000000;}
    /* De kleur van de actieve (= aangeklikte) tekst op de bovenste menubalk */
    div.WinBalk a.WinKnopActive,
    div.WinBalk a.WinKnopActive:hover {
    background-color: #FFFFFF;
    border-color: #FFFFFF #FFFFFF #FFFFFF #FFFFFF;
    color: #000000;
    left: 1px;
    top: 1px;}
    /* De achtergrondkleur van de submenu's */
    div.menu {
    background-color: #FF0000;
    border: 2px solid;
    border-color: #FF0000 #FF0000 #FF0000 #FF0000;
    left: 0px;
    padding: 0px 1px 1px 0px;
    position: absolute;
    top: 0px;
    visibility: hidden;
    z-index: 101;}
    /* De 'normale' tekstkleur van de submenu's */
    div.menu a.WinItem {
    color: #000000;
    cursor: default;
    display: block;
    padding: 3px 1em;
    text-decoration: none;
    white-space: nowrap;}
    /* Achtergrondkleur en tekstkleur submenu's bij mouseover */
    div.menu a.WinItem:hover, div.menu a.WinItemOplichten {
    background-color: #FF0000;
    color: #000000;}
    div.menu a.WinItem span.WinItemText {}
    div.menu a.WinItem span.WinItempijltje {
    margin-right: -.75em;}
    div.menu div.WinItemlijntje {
    border-top: 1px solid #CC9900;
    border-bottom: 1px solid #CC9966;
    margin: 4px 2px;}
    .style37 {
    font-family: "Comic Sans MS";
    font-size: 14pt;
    }
    .style40 {font-family: "Comic Sans MS"; font-size: 14pt; color: #FFFFFF; }
    .style42 {font-family: "Comic Sans MS"; font-size: 14pt; color: #ECE9D8; }
    .style43 {font-family: "Comic Sans MS"}
    </style>

    <!– Het script : niets aan wijzigen ! –>
    <script language= "JavaScript" type="text/javascript">
    function Browser() {var ua,s,i;this.isIE=false;this.isNS=false;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;}s="Gecko";if((i=ua.indexOf(s))>=0){this.isNS=true;this.version=6.1;
    return;}}var browser=new Browser();var activeButton=null;
    if(browser.isIE)document.onmousedown=pageMousedown;
    else document.addEventListener("mousedown",pageMousedown,true);
    function pageMousedown(event){var el;if(activeButton==null)return;
    if(browser.isIE)el=window.event.srcElement;
    else el=(event.target.tagName?event.target:event.target.parentNode);
    if(el== activeButton)return;
    if(getContainerWith(el,"DIV","menu")==null){resetButton(activeButton);activeButton = null;
    }}
    function buttonClick(event,menuId){var button;
    if(browser.isIE)button=window.event.srcElement;
    else button=event.currentTarget;button.blur();
    if(button.menu==null){button.menu = document.getElementById(menuId);
    if(button.menu.isInitialized==null)menuInit(button.menu);}
    if(activeButton!=null)resetButton(activeButton);
    if(button!=activeButton){depressButton(button);activeButton = button;}
    elseactiveButton=null;return false;}
    function buttonMouseover(event, menuId){var button;
    if(browser.isIE)button=window.event.srcElement;else button=event.currentTarget;
    if(activeButton!=null&&activeButton!=button)buttonClick(event, menuId);}
    function depressButton(button){var x,y;button.className+=" WinKnopActive";
    x=getPageOffsetLeft(button);y=getPageOffsetTop(button)+ button.offsetHeight;
    if (browser.isIE){x+=button.offsetParent.clientLeft;
    y+=button.offsetParent.clientTop;}
    button.menu.style.left=x+"px";button.menu.style.top=y+"px";
    button.menu.style.visibility="visible";}
    function resetButton(button){removeClassName(button,"WinKnopActive");
    if(button.menu!=null){closeSubMenu(button.menu);button.menu.style.visibility="hidden";}}
    function menuMouseover(event){var menu;
    if(browser.isIE)menu=getContainerWith(window.event.srcElement,"DIV","menu");
    else menu=event.currentTarget;if(menu.activeItem!=null)closeSubMenu(menu);}
    function WinItemMouseover(event,menuId){var item,menu,x,y;
    if(browser.isIE)item=getContainerWith(window.event.srcElement,"A","WinItem");
    else item=event.currentTarget;menu=getContainerWith(item,"DIV","menu");
    if(menu.activeItem!=null)closeSubMenu(menu);menu.activeItem=item;
    item.className+=" WinItemOplichten";
    if(item.subMenu==null){item.subMenu=document.getElementById(menuId);
    if(item.subMenu.initialized==null)menuInit(item.subMenu);}
    x=getPageOffsetLeft(item)+item.offsetWidth;y=getPageOffsetTop(item);var maxX,maxY;
    if(browser.isNS){maxX=window.scrollX+window.innerWidth;
    maxY=window.scrollY+window.innerHeight;}
    if(browser.isIE){maxX=(document.documentElement.scrollLeft!=0?
    document.documentElement.scrollLeft:document.body.scrollLeft)
    +(document.documentElement.clientWidth!=0?
    document.documentElement.clientWidth:document.body.clientWidth);
    maxY=(document.documentElement.scrollTop!=0?
    document.documentElement.scrollTop:document.body.scrollTop)
    +(document.documentElement.clientHeight!=0?
    document.documentElement.clientHeight:document.body.clientHeight);}
    maxX-=item.subMenu.offsetWidth;maxY-=item.subMenu.offsetHeight;
    if(x>maxX)x=Math.max(0,x-item.offsetWidth-item.subMenu.offsetWidth
    +(menu.offsetWidth-item.offsetWidth));y=Math.max(0,Math.min(y, maxY));
    item.subMenu.style.left=x+"px";item.subMenu.style.top=y+"px";
    item.subMenu.style.visibility="visible";
    if(browser.isIE)window.event.cancelBubble=true;else event.stopPropagation();}
    function closeSubMenu(menu){if(menu==null||menu.activeItem==null)return;
    if(menu.activeItem.subMenu!=null){closeSubMenu(menu.activeItem.subMenu);
    menu.activeItem.subMenu.style.visibility="hidden";menu.activeItem.subMenu=null;}
    removeClassName(menu.activeItem,"WinItemOplichten");menu.activeItem=null;}
    function menuInit(menu){
    var itemList,spanList;var textEl,pijltjeEl;var itemWidth;var w,dw;var i,j;
    if(browser.isIE){menu.style.lineHeight="2.5ex";
    spanList=menu.getElementsByTagName("SPAN");
    for(i=0;i< spanList.length; i++)
    if(hasClassName(spanList[i],"WinItempijltje")){
    spanList[i].style.fontFamily="Webdings";spanList[i].firstChild.nodeValue="4";}}
    itemList=menu.getElementsByTagName("A");
    if(itemList.length>0)itemWidth=itemList[0].offsetWidth;else return;
    for(i=0; i < itemList.length; i++) {
    spanList=itemList[i].getElementsByTagName("SPAN")
    textEl=null
    pijltjeEl = null;
    for(j=0; j < spanList.length; j++) {
    if(hasClassName(spanList[j],"WinItemText"))textEl=spanList[j];
    if(hasClassName(spanList[j],"WinItempijltje"))pijltjeEl=spanList[j];}
    if(textEl!=null&&pijltjeEl!=null)
    textEl.style.paddingRight=(itemWidth-(textEl.offsetWidth+pijltjeEl.offsetWidth))+"px";}
    if (browser.isIE){w=itemList[0].offsetWidth;
    itemList[0].style.width=w+"px";dw=itemList[0].offsetWidth-w;w-=dw;
    itemList[0].style.width=w+"px";}
    menu.initialized=true;}
    function getContainerWith(node,tagName,className){
    while(node!=null){
    if(node.tagName!=null&&node.tagName==tagName&&hasClassName(node,className))
    return node;node=node.parentNode;}return node;}
    function hasClassName(el,name){
    var i,list;list=el.className.split(" ");
    for(i=0;i<list.length;i++)if(list[i]==name)return true;return false;}
    function removeClassName(el,name){
    var i,curList,newList;if(el.className==null)return;
    newList=new Array();curList=el.className.split(" ");
    for(i=0;i<curList.length;i++)
    if(curList[i]!=name)newList.push(curList[i]);el.className=newList.join(" ");}
    function getPageOffsetLeft(el){var x;x=el.offsetLeft;
    if(el.offsetParent!=null)x+=getPageOffsetLeft(el.offsetParent);return x;}
    function getPageOffsetTop(el){var y;y=el.offsetTop;
    if(el.offsetParent!=null)y+=getPageOffsetTop(el.offsetParent);return y;}
    </script>
    [/code:1:5a3d3e4a75]


    En tussen mijn body:


    [code:1:5a3d3e4a75]<!– HIER BEGINT DE MENUBALK. –>
    <div class="WinBalk" style="position:relative; width=100%;top: 40px;">

    <!– Tekst op de menubalk –>

    <a class="WinKnop"
    href="FC%20Zwolle/index.php"
    onclick="return buttonClick(event, 'HomeMenu');"
    onmouseover="buttonMouseover(event, 'HomeMenu');"> Home
    </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <a
    class="WinKnop"
    href="#"
    onclick="return buttonClick(event, 'FCZwolleC1Menu');"
    onmouseover="buttonMouseover(event, 'FCZwolleC1Menu');"> FC Zwolle C1
    </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;

    <a class="WinKnop"
    href="#"
    onclick="return buttonClick(event, 'CompetitieMenu');"
    onmouseover="buttonMouseover(event, 'CompetitieMenu');"> Competitie
    </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
    <a class="WinKnop"
    href="#"
    onclick="return buttonClick(event, 'StatistiekenMenu');"
    onmouseover="buttonMouseover(event, 'StatistiekenMenu');"> Statistieken
    </a>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <a class="WinKnop"
    href="FC%20Zwolle/index.php?page=verjaardagen"
    onclick="return buttonClick(event, 'VerjaardagenMenu');"
    onmouseover="buttonMouseover(event, 'VerjaardagenMenu');"> Verjaardagen
    </a>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
    <a class="WinKnop"
    href="#"
    onclick="return buttonClick(event, 'VoetbalpoolMenu');"
    onmouseover="buttonMouseover(event, 'VoetbalpoolMenu');"> Voetbalpool
    </a>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
    <a class="WinKnop"
    href="#"
    onclick="return buttonClick(event, 'GastenboekMenu');"
    onmouseover="buttonMouseover(event, 'GastenboekMenu');"> Gastenboek
    </a>

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
    <a class="WinKnop"
    href="#"
    onclick="return buttonClick(event, 'PollMenu');"
    onmouseover="buttonMouseover(event, 'PollMenu');"> Poll
    </a>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
    <a class="WinKnop"
    href="#"
    onclick="return buttonClick(event, 'ConactMenu');"
    onmouseover="buttonMouseover(event, 'ContactMenu');"> &nbsp; &nbsp;Contact</div>
    <!– Menu FC Zwolle c1 –>

    <div id="FCZwolleC1Menu" class="menu"
    onmouseover="menuMouseover(event)">
    <a class="WinItem" href="#">Spelersselectie in Staf</a>
    <a class="WinItem" href="#">Corveelijst</a>
    <a class="WinItem" href="#">Verslagen</a>
    <a class="WinItem" href="#">Geblesseerden</a>
    <a class="WinItem" href="#">Opstelling</a>
    </div>

    <!– Menu Competitie –>

    <div id="CompetitieMenu" class="menu"
    onmouseover="menuMouseover(event)">
    <a class="WinItem" href="#">Stand</a>
    <a class="WinItem" href="#">Uitslagen</a>
    <a class="WinItem" href="#">Wedstrijden</a>
    <a class="WinItem" href="#">Programma</a>
    <a class="WinItem" href="#">Speelschema</a>
    <a class="WinItem" href="#">Competitieindeling</a>
    <a class="WinItem" href="#">Verslagen</a>
    </div>

    <!– Menu Statistieken –>

    <div id="StatistiekenMenu" class="menu">
    <a class="WinItem" href="#">Topscoorders</a>
    <a class="WinItem" href="#">Kaarten</a>
    </div>

    <!– Menu Voetbalpool –>

    <div id="VoetbalpoolMenu" class="menu"
    onmouseover="menuMouseover(event)">
    <a class="WinItem" href="#">Meedoen</a>
    <a class="WinItem" href="#">Spelregels</a>
    <a class="WinItem" href="#">Stand</a>
    </div>
    [/code:1:5a3d3e4a75]
  • in MOzilla Firefox werkt t wel gewoon. Ik zie ook dat in IE niet naar behoren werkt. Het si een beetje veel code, misschien dat ik morgen even naar ga kjiken, nu in ieder geval niet meer.

    Kijk ook eens op http://www.htmldog.com/articles/suckerfish/dropdowns/
    HIer staat hoe je een menuutje kan maken met alleen maar CSS. Dit kan eignelijki niet mis gaan.
  • Holy
    [quote:a6d1ad9bc6="TvSchendel"][code:1:a6d1ad9bc6]
    <!– Het script : niets aan wijzigen ! –>
    <script language= "JavaScript" type="text/javascript">
    function Browser() {var ua,s,i;this.isIE=false;this.isNS=false;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;}s="Gecko";if((i=ua.indexOf(s))>=0){this.isNS=true;this.version=6.1;
    return;}}var browser=new Browser();var activeButton=null;
    if(browser.isIE)document.onmousedown=pageMousedown;
    else document.addEventListener("mousedown",pageMousedown,true);
    function pageMousedown(event){var el;if(activeButton==null)return;
    if(browser.isIE)el=window.event.srcElement;
    else el=(event.target.tagName?event.target:event.target.parentNode);
    if(el== activeButton)return;
    if(getContainerWith(el,"DIV","menu")==null){resetButton(activeButton);activeButton = null;
    }}
    function buttonClick(event,menuId){var button;
    if(browser.isIE)button=window.event.srcElement;
    else button=event.currentTarget;button.blur();
    if(button.menu==null){button.menu = document.getElementById(menuId);
    if(button.menu.isInitialized==null)menuInit(button.menu);}
    if(activeButton!=null)resetButton(activeButton);
    if(button!=activeButton){depressButton(button);activeButton = button;}
    elseactiveButton=null;return false;}
    function buttonMouseover(event, menuId){var button;
    if(browser.isIE)button=window.event.srcElement;else button=event.currentTarget;
    if(activeButton!=null&&activeButton!=button)buttonClick(event, menuId);}
    function depressButton(button){var x,y;button.className+=" WinKnopActive";
    x=getPageOffsetLeft(button);y=getPageOffsetTop(button)+ button.offsetHeight;
    if (browser.isIE){x+=button.offsetParent.clientLeft;
    y+=button.offsetParent.clientTop;}
    button.menu.style.left=x+"px";button.menu.style.top=y+"px";
    button.menu.style.visibility="visible";}
    function resetButton(button){removeClassName(button,"WinKnopActive");
    if(button.menu!=null){closeSubMenu(button.menu);button.menu.style.visibility="hidden";}}
    function menuMouseover(event){var menu;
    if(browser.isIE)menu=getContainerWith(window.event.srcElement,"DIV","menu");
    else menu=event.currentTarget;if(menu.activeItem!=null)closeSubMenu(menu);}
    function WinItemMouseover(event,menuId){var item,menu,x,y;
    if(browser.isIE)item=getContainerWith(window.event.srcElement,"A","WinItem");
    else item=event.currentTarget;menu=getContainerWith(item,"DIV","menu");
    if(menu.activeItem!=null)closeSubMenu(menu);menu.activeItem=item;
    item.className+=" WinItemOplichten";
    if(item.subMenu==null){item.subMenu=document.getElementById(menuId);
    if(item.subMenu.initialized==null)menuInit(item.subMenu);}
    x=getPageOffsetLeft(item)+item.offsetWidth;y=getPageOffsetTop(item);var maxX,maxY;
    if(browser.isNS){maxX=window.scrollX+window.innerWidth;
    maxY=window.scrollY+window.innerHeight;}
    if(browser.isIE){maxX=(document.documentElement.scrollLeft!=0?
    document.documentElement.scrollLeft:document.body.scrollLeft)
    +(document.documentElement.clientWidth!=0?
    document.documentElement.clientWidth:document.body.clientWidth);
    maxY=(document.documentElement.scrollTop!=0?
    document.documentElement.scrollTop:document.body.scrollTop)
    +(document.documentElement.clientHeight!=0?
    document.documentElement.clientHeight:document.body.clientHeight);}
    maxX-=item.subMenu.offsetWidth;maxY-=item.subMenu.offsetHeight;
    if(x>maxX)x=Math.max(0,x-item.offsetWidth-item.subMenu.offsetWidth
    +(menu.offsetWidth-item.offsetWidth));y=Math.max(0,Math.min(y, maxY));
    item.subMenu.style.left=x+"px";item.subMenu.style.top=y+"px";
    item.subMenu.style.visibility="visible";
    if(browser.isIE)window.event.cancelBubble=true;else event.stopPropagation();}
    function closeSubMenu(menu){if(menu==null||menu.activeItem==null)return;
    if(menu.activeItem.subMenu!=null){closeSubMenu(menu.activeItem.subMenu);
    menu.activeItem.subMenu.style.visibility="hidden";menu.activeItem.subMenu=null;}
    removeClassName(menu.activeItem,"WinItemOplichten");menu.activeItem=null;}
    function menuInit(menu){
    var itemList,spanList;var textEl,pijltjeEl;var itemWidth;var w,dw;var i,j;
    if(browser.isIE){menu.style.lineHeight="2.5ex";
    spanList=menu.getElementsByTagName("SPAN");
    for(i=0;i< spanList.length; i++)
    if(hasClassName(spanList[i],"WinItempijltje")){
    spanList[i].style.fontFamily="Webdings";spanList[i].firstChild.nodeValue="4";}}
    itemList=menu.getElementsByTagName("A");
    if(itemList.length>0)itemWidth=itemList[0].offsetWidth;else return;
    for(i=0; i < itemList.length; i++) {
    spanList=itemList[i].getElementsByTagName("SPAN")
    textEl=null
    pijltjeEl = null;
    for(j=0; j < spanList.length; j++) {
    if(hasClassName(spanList[j],"WinItemText"))textEl=spanList[j];
    if(hasClassName(spanList[j],"WinItempijltje"))pijltjeEl=spanList[j];}
    if(textEl!=null&&pijltjeEl!=null)
    textEl.style.paddingRight=(itemWidth-(textEl.offsetWidth+pijltjeEl.offsetWidth))+"px";}
    if (browser.isIE){w=itemList[0].offsetWidth;
    itemList[0].style.width=w+"px";dw=itemList[0].offsetWidth-w;w-=dw;
    itemList[0].style.width=w+"px";}
    menu.initialized=true;}
    function getContainerWith(node,tagName,className){
    while(node!=null){
    if(node.tagName!=null&&node.tagName==tagName&&hasClassName(node,className))
    return node;node=node.parentNode;}return node;}
    function hasClassName(el,name){
    var i,list;list=el.className.split(" ");
    for(i=0;i<list.length;i++)if(list[i]==name)return true;return false;}
    function removeClassName(el,name){
    var i,curList,newList;if(el.className==null)return;
    newList=new Array();curList=el.className.split(" ");
    for(i=0;i<curList.length;i++)
    if(curList[i]!=name)newList.push(curList[i]);el.className=newList.join(" ");}
    function getPageOffsetLeft(el){var x;x=el.offsetLeft;
    if(el.offsetParent!=null)x+=getPageOffsetLeft(el.offsetParent);return x;}
    function getPageOffsetTop(el){var y;y=el.offsetTop;
    if(el.offsetParent!=null)y+=getPageOffsetTop(el.offsetParent);return y;}
    </script>
    [/code:1:a6d1ad9bc6][/quote:a6d1ad9bc6]
    Ik ben zo vrij geweest om het te herformatteren.
    Er zaten ook nog wat copy&paste-fouten in, zoals Else (met een hoofdletter), Else zonder spatie gevolgd door het volgende commando, niet afsluiten van een regel met ;.

    [code:1:a6d1ad9bc6]
    <!– Het script : niets aan wijzigen ! –>
    <script language= "JavaScript" type="text/javascript">
    function Browser()
    { var ua,s,i;
    this.isIE=false;
    this.isNS=false;
    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;
    }

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

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

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

    function pageMousedown(event)
    { var el;
    if (activeButton==null)
    return;

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

    if (el== activeButton)
    return;

    if (getContainerWith(el,"DIV","menu")==null)
    { resetButton(activeButton);
    activeButton = null;
    }
    }

    function buttonClick(event,menuId)
    { var button;
    if (browser.isIE)
    button=window.event.srcElement;
    else
    button=event.currentTarget;button.blur();

    if (button.menu==null)
    { button.menu = document.getElementById(menuId);

    if (button.menu.isInitialized==null)
    menuInit(button.menu);
    }

    if (activeButton!=null)
    resetButton(activeButton);

    if (button!=activeButton)
    { depressButton(button);
    activeButton = button;
    }
    else
    activeButton=null;

    return false;
    }

    function buttonMouseover(event, menuId)
    { var button;

    if (browser.isIE)
    button=window.event.srcElement;
    else
    button=event.currentTarget;

    if (activeButton != null && activeButton != button)
    buttonClick(event, menuId);
    }

    function depressButton(button)
    { var x,y;

    button.className+=" WinKnopActive";
    x=getPageOffsetLeft(button);
    y=getPageOffsetTop(button)+ button.offsetHeight;

    if (browser.isIE)
    { x+=button.offsetParent.clientLeft;
    y+=button.offsetParent.clientTop;
    }

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

    function resetButton(button)
    { removeClassName(button,"WinKnopActive");

    if (button.menu!=null)
    { closeSubMenu(button.menu);
    button.menu.style.visibility="hidden";
    }
    }

    function menuMouseover(event)
    { var menu;

    if (browser.isIE)
    menu=getContainerWith(window.event.srcElement,"DIV","menu");
    else
    menu=event.currentTarget;

    if (menu.activeItem!=null)
    closeSubMenu(menu);
    }

    function WinItemMouseover(event,menuId)
    { var item,menu,x,y;

    if (browser.isIE)
    item=getContainerWith(window.event.srcElement,"A","WinItem");
    else
    item=event.currentTarget;
    menu=getContainerWith(item,"DIV","menu");

    if (menu.activeItem!=null)
    closeSubMenu(menu);

    menu.activeItem=item;
    item.className+=" WinItemOplichten";

    if (item.subMenu==null)
    { item.subMenu=document.getElementById(menuId);
    if (item.subMenu.initialized==null)
    menuInit(item.subMenu);
    }

    x=getPageOffsetLeft(item)+item.offsetWidth;
    y=getPageOffsetTop(item);

    var maxX,maxY;
    if (browser.isNS)
    { maxX=window.scrollX+window.innerWidth;
    maxY=window.scrollY+window.innerHeight;
    }

    if (browser.isIE)
    { maxX=(document.documentElement.scrollLeft!=0 ? document.documentElement.scrollLeft:document.body.scrollLeft) +
    (document.documentElement.clientWidth!=0 ? document.documentElement.clientWidth:document.body.clientWidth);
    maxY=(document.documentElement.scrollTop!=0 ? document.documentElement.scrollTop:document.body.scrollTop) +
    (document.documentElement.clientHeight!=0 ? document.documentElement.clientHeight:document.body.clientHeight);
    }

    maxX-=item.subMenu.offsetWidth;
    maxY-=item.subMenu.offsetHeight;
    if (x>maxX)
    x=Math.max(0,x-item.offsetWidth-item.subMenu.offsetWidth +(menu.offsetWidth-item.offsetWidth));

    y=Math.max(0,Math.min(y, maxY));
    item.subMenu.style.left=x+"px";
    item.subMenu.style.top=y+"px";
    item.subMenu.style.visibility="visible";
    if (browser.isIE)
    window.event.cancelBubble=true;
    else
    event.stopPropagation();
    }

    function closeSubMenu(menu)
    { if (menu==null||menu.activeItem==null)
    return;

    if (menu.activeItem.subMenu!=null)
    { closeSubMenu(menu.activeItem.subMenu);
    menu.activeItem.subMenu.style.visibility="hidden";
    menu.activeItem.subMenu=null;
    }

    removeClassName(menu.activeItem,"WinItemOplichten");
    menu.activeItem=null;
    }

    function menuInit(menu)
    { var itemList,spanList;
    var textEl,pijltjeEl;
    var itemWidth;
    var w,dw;
    var i,j;

    if (browser.isIE)
    { menu.style.lineHeight="2.5ex";
    spanList=menu.getElementsByTagName("SPAN");

    for (i=0;i< spanList.length; i++)
    if (hasClassName(spanList[i],"WinItempijltje"))
    { spanList[i].style.fontFamily="Webdings";spanList[i].firstChild.nodeValue="4";
    }
    }

    itemList=menu.getElementsByTagName("A");
    if (itemList.length>0)
    itemWidth=itemList[0].offsetWidth;
    else
    return;

    for (i=0; i < itemList.length; i++)
    { spanList=itemList[i].getElementsByTagName("SPAN");
    textEl=null;
    pijltjeEl = null;

    for (j=0; j < spanList.length; j++)
    { if (hasClassName(spanList[j],"WinItemText"))
    textEl=spanList[j];
    if (hasClassName(spanList[j],"WinItempijltje"))
    pijltjeEl=spanList[j];
    }

    if (textEl!=null&&pijltjeEl!=null)
    textEl.style.paddingRight=(itemWidth-(textEl.offsetWidth+pijltjeEl.offsetWidth))+"px";
    }

    if (browser.isIE)
    { w=itemList[0].offsetWidth;
    itemList[0].style.width=w+"px";
    dw=itemList[0].offsetWidth-w;
    w-=dw;

    itemList[0].style.width=w+"px";
    }

    menu.initialized=true;
    }

    function getContainerWith(node,tagName,className)
    { while(node!=null)
    { if (node.tagName!=null && node.tagName==tagName && hasClassName(node,className))
    return node;

    node=node.parentNode;
    }
    return node;
    }

    function hasClassName(el,name)
    { var i,list;
    list=el.className.split(" ");

    for (i=0;i<list.length;i++)
    if (list[i]==name)
    return true;

    return false;
    }

    function removeClassName(el,name)
    { var i,curList,newList;

    if (el.className==null)
    return;

    newList=new Array();
    curList=el.className.split(" ");

    for (i=0;i<curList.length;i++)
    if (curList[i]!=name)
    newList.push(curList[i]);

    el.className=newList.join(" ");
    }

    function getPageOffsetLeft(el)
    { var x;
    x=el.offsetLeft;

    if (el.offsetParent!=null)
    x+=getPageOffsetLeft(el.offsetParent);
    return x;
    }

    function getPageOffsetTop(el)
    { var y;
    y=el.offsetTop;

    if (el.offsetParent!=null)
    y+=getPageOffsetTop(el.offsetParent);

    return y;
    }
    </script>
    [/code:1:a6d1ad9bc6]
    Geen idee of het nu wel werkt. :roll:
  • [quote:45bc9d6bfd="marientje"]Het is een beetje veel code…[/quote:45bc9d6bfd]
    dat is nog een understatement…

    Gebruik inderdaad beter suckerfish…if iets wat daarop lijkt. Dan werkt het ook nog zonder javascript en het is tenminste een beetje logisch..
  • Helaas doet het menu het nog steeds niet.
    Maar in ieder geval hardstikke bedankt dat u der zoveel tijd in heeft gestoken.Misschien dat er nog meer mensen een idee hebbe waar het aan kan liggen.

Beantwoord deze vraag

Dit is een gearchiveerde pagina. Antwoorden is niet meer mogelijk.