Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by John van Arkelen on Jan 08, 2009 05:26
open dhtmlx forum
dhtml menubar doesn't work in IE

Hi,

The dhtml menubar I use works great in Firefox, but in IE (both 6 and 7) it gives an error and doesn't load at all.
This is my code:

<link rel="stylesheet" type="text/css" href="css/dhtmlxmenu_modern_black.css">
<link rel="stylesheet" type="text/css" href="css/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="css/dhtmlxmenu_modern_black.css">
<link rel="stylesheet" type="text/css" href="css/dhtmlxgrid.css">

        <center><div id="menu" style="width: 1000px;"></div></center>

        <script>
            var menu = new dhtmlXMenuObject("menu", "modern_black");
            menu.addNewSibling(null, "home", "Home", false);
            menu.addNewSibling("home", "salves", "Salves", false);
                menu.addNewChild("salves", 0, "s3", "Forum", false);
                menu.addNewChild("salves", 0, "s4", "Opleidingen", false);
                menu.addNewChild("salves", 0, "s2", "Onderhoud help teksten", false);
                menu.addNewChild("salves", 0, "s5", "Onderhoud nieuwsberichten", false);
                menu.addNewChild("salves", 0, "s6", "Gegevens medewerkers", false);
                menu.addNewChild("salves", 0, "s7", "Wijzigen wachtwoord", false);
                menu.addNewChild("salves", 0, "s8", "Mijn gegevens", false);
            menu.addNewSibling("salves", "timesheet", "Timesheets", false);
                menu.addNewChild("timesheet", 0, "t1", "Status per medewerker", false);
                menu.addNewChild("timesheet", 0, "t2", "Ingeleverde timesheets", false);
            menu.addNewSibling("timesheet", "declaraties", "Declaraties", false);
                menu.addNewChild("declaraties", 0, "d1", "Ingeleverde declaraties", false);
            menu.addNewSibling("declaraties", "overzichten", "Overzichten", false);
                menu.addNewChild("overzichten", 0, "o1", "Uren per klant", false);
                menu.addNewChild("overzichten", 0, "o2", "Declaraties", false);
                menu.addNewChild("overzichten", 0, "o3", "Lease kilometers", false);
                menu.addNewChild("overzichten", 0, "o4", "Vrije dagen", false);
                menu.addNewChild("overzichten", 0, "o5", "Cumulatieve uren", false);
                menu.addNewChild("overzichten", 0, "o6", "Bonus uren", false);
                menu.addNewChild("overzichten", 0, "o7", "Billable uren", false);
            menu.addNewSibling("overzichten", "onderhoud", "Onderhoud", false);
                menu.addNewChild("onderhoud", 0, "oh1", "Medewerker uit dienst", false);
                menu.addNewChild("onderhoud", 0, "oh2", "Unbillable codes", false);
                menu.addNewChild("onderhoud", 0, "oh3", "Klanten", false);
                menu.addNewChild("onderhoud", 0, "oh4", "Medewerkers", false);
            menu.attachEvent("onClick", function(id){
                if (id == "home"){location.href='index.php';}
                if (id == "s2"){location.href='index.php?page=help';}
                if (id == "s3"){location.href='index.php?page=forum';}
                if (id == "s4"){location.href='index.php?page=academy_home';}
                if (id == "s5"){location.href='index.php?page=news&from=timesheet';}
                if (id == "s6"){location.href='index.php?page=profile&action=other';}
                if (id == "s7"){location.href='index.php?page=profile&action=password';}
                if (id == "s8"){location.href='index.php?page=profile&action=own';}
                if (id == "t1"){location.href='index.php?page=status';}
                if (id == "t2"){location.href='index.php?page=matrix&type=timesheets';}
                if (id == "d1"){location.href='index.php?page=matrix&type=declarations';}
                if (id == "o1"){location.href='index.php?page=reports&type=client';}
                if (id == "o2"){location.href='index.php?page=reports&type=declaration';}
                if (id == "o3"){location.href='index.php?page=reports&type=km';}
                if (id == "o4"){location.href='index.php?page=reports&type=unbillable';}
                if (id == "o5"){location.href='index.php?page=reports&type=cumulative';}
                if (id == "o6"){location.href='index.php?page=reports&type=bonus';}
                if (id == "o7"){location.href='index.php?page=reports&type=billable';}
                if (id == "oh1"){location.href='index.php?page=maintenance&action=exit';}
                if (id == "oh2"){location.href='index.php?page=maintenance&action=unbillable';}
                if (id == "oh3"){location.href='index.php?page=maintenance&action=clients';}
                if (id == "oh4"){location.href='index.php?page=maintenance&action=employees';}
         });
        </script>    
Answer posted by Support on Jan 08, 2009 06:16
Hello,

Here is:

<body onload="doOnLoad();">
...
<script>
    var menu;
    function doOnLoad() {
        menu = new dhtmlXMenuObject("menu", "modern_black");
        ...
    }
</scipt>

</body>
Answer posted by John van Arkelen on Jan 08, 2009 06:47
Thank you, that works!