PDA

View Full Version : how to initialize multiple instances on one page?



p2ds
05-14-2010, 01:11 AM
Hello,

:confused:

Using Script Title: ddsmoothmenu

Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm

3) Trying to use three vertical menus on the same page and receive the following error:
'parent().get(...)' is null or not an object

My page with the error:
http://aprilbarrett.com/test/personal/savings/cod.asp

The javascript page:
http://aprilbarrett.com/test/scripts/ddsmoothmenu.js

I think I figured out that it doesn't like that I call multiple menu instances on a single page.

Any way to combine the following?


ddsmoothmenu.init({
mainmenuid: "persMenu", //Menu DIV id
orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

ddsmoothmenu.init({
mainmenuid: "busMenu", //Menu DIV id
orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

ddsmoothmenu.init({
mainmenuid: "onlinesMenu", //Menu DIV id
orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

jscheuer1
05-14-2010, 04:12 AM
You actually have 4 calls, not just the three shown in your post. That's not the problem (the demo page has three menus and there is virtually no limit on the number of these menus you may have on one page). I haven't narrowed it down, but it looks like an issue with the markup (though it could possibly be something else). The script is looking for something that's not there, which probably means you've deviated from the markup template in some way.

The menus do work though, so you haven't done anything major, and I know it can be hard sometimes to know what modifications are OK, and which may cause an error.

Off hand, can you think of anything in your markup that deviates from the proscribed template offered on the demo page? Perhaps some added feature or look you threw in?

p2ds
05-14-2010, 04:15 PM
Thanks.

I figured out what I did wrong. The init settings did not correspond to my div tags correctly. It was a dumb thing to do - but at least the issue wasn't major.

amanruzaini
08-04-2011, 05:21 PM
Hi,

may i know how u fix this? im having the same problem yet still cannot find any solution.

thanks mate :)