JavaScript error on page - why? What is it?

Associate
Joined
20 Oct 2002
Posts
680
Hi All. Just wondering if anyone could shed some light on this error I have on a website. It uses a JavaScript menu and every page that has the menu on has an error at this point...

m.initTop(); <----HERE
m.init();
m.show();
</script>

The error is...

Object doesn't support this property or method.

The error does not seem to have any effect on the workings of the site and the menu works fine…weird.

I know less than nothing about JavaScript but know a bit about other languages. Anyone have any ideas or able to point me in the right direction?

Many thanks.
 
Thanks for the posts. This was a third party menu as you will see from the script. I have emailed the developers but so far no response!

This is the entire piece of code...

<script type="text/javascript" src="common/js/coolmenupro.js"></script>
<script type="text/javascript" src="common/js/menuitems.js"></script>
<script type="text/javascript">
var m = new COOLjsMenuPRO("menu1", MENU_ITEMS_ARROWS)
m.initTop();
m.init();
m.show();
</script>

You may need some code from the other linked js files?

Many thanks.
 
What is MENU_ITEMS_ARROWS defined as?

See if the one from the guide works (http://javascript.cooldev.com/doc/menu/#s4_2):


Code:
<html>
    <head>
        <script type="text/javascript" src="coolmenu.js"></script>
    </head>
    <body>
        <script type="text/javascript">
// Part 1 - Styles
var STYLE = {
    border:1,              // item's border width, pixels; zero means "none";
    shadow:2,              // item's shadow size, pixels; zero means "none"
    color:{
        border:"#666666",  // color of the item border, if any;
        shadow:"#DBD8D1",  // color of the item shadow, if any;
        bgON:"white",      // background color for the items;
        bgOVER:"#B6BDD2"   // background color for the item
                           // which is under mouse right now;
    },
    css:{
        ON:null,           // CSS class for items;
        OVER:null          // CSS class  for item which is under mouse;
    }
};

// Part 2 - Menu structure
var MENU_ITEMS = [
    {pos:[10,10], itemoff:[0,99], leveloff:[21,0], style:STYLE, size:[22,100]},
    {code:"Item 1", url:"item1.html",
        sub:[
            {"itemoff":[21,0]},
            {code:"SubItem 1", "url":"subitem1_1.html"},
            {code:"SubItem 2", "url":"subitem1_2.html"},
            {code:"SubItem 3", "url":"subitem1_3.html"},
            {code:"SubItem 4", "url":"subitem1_4.html"}
        ]
    },
    {code:"Item 2", url:"item2.html",
        sub:[
            {itemoff:[21,0]},
            {code:"SubItem 1", "url":"subitem2_1.html"},
            {code:"SubItem 2", "url":"subitem2_2.html"},
            {code:"SubItem 3", "url":"subitem2_3.html"},
            {code:"SubItem 4", "url":"subitem2_4.html"}
        ]
    }
];

// Part 3 - Initialization code
var m1 = new COOLjsMenu("menu1", MENU_ITEMS);
                </script>
        </body>
</html>

Edit: I'd actually dump this whole CooljsMenu system and use something more 'open', such as a Jquery based plugin one, e.g. http://jdsharp.us/jQuery/plugins/jdMenu/
 
Last edited:
Back
Top Bottom