Error: _M has no properties ???

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Error: _M has no properties ???

Post by tmakaro »

Can someone please tell me why I am getting the following error message:

Error: _M has no properties
Source File: file:///C:/milonicTest/menu/mmenudom.js
Line: 20

I am creating sub menus dynamically when i hover over the parent menu for the first time. I'm using:

Version 5.742 - Built: Wednesday January 25 2006 - 9:17

You can see the problem for yourself at http://www.makaro.com/milonic/test.html

just hover over one of the menus to recreate the error. The sub menu will display just fine but the javascript error will show up in your error console.

Troy
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

We can't help on this you are way downlevel on the menu. You need to upgrade to the newest version.

Ruth
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

OK, I have upgraded to the newest version! Of course now it doesn't work at all :(

Try it for yourself at: http://www.makaro.com/milonic2/test.html

I suspect it has something to do with the mm_createNewMenus method I have:


function displaySubMenu() {
currentItem = _itemRef;
mm_createNewMenus();
$H(currentItem);
}

function _excMD($dta) {
_it=$dta.split(":");
_DoP=_it[1]
return _DoP.replace(/;/g,Z$)
}

function mm_createNewMenus() {
$r();
_startM=0
for(_y=_mcnt;_y<_m.length;_y++) {
_NM=_m[_y]
_nM=_d.createElement("div")
_nM.id="menu"+_y
_nM.onmouseout=new Function("$I()");
_nM.onmouseover=new Function("$J("+_y+")");
_nM.onselectstart=new Function("return _f");

if(_dB.appendChild)
{
_dB.appendChild(_nM)
o$(_y,0)
_nM.className=_cls
_nS=_nM.style
if($1B)_nS.padding=_excMD($1B)
if(_NM[17])_nS.width=$pX(_NM[17])
if(_NM[24])_nS.height=$pX(_NM[24])
if(_ofb)_nS.background=_excMD(_ofb)
if(p_)_nS.border=_excMD(p_)
if(_wid)_nS.width=_excMD(_wid)
_nM.style.zindex=499
_nM.style.visibility=_visi
if(n_)_nS.position=_excMD(n_)
if($k)_nS.top=_excMD($k)
if($l)_nS.left=_excMD($l)
if(_bgimg)_nS.backgroundImage="url("+_excMD(_bgimg)+")";
//if(_mbgc)_nS.background=_excMD(_mbgc)
_NM[23]=0
}
}
}
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

The functions you are using are actually included inside http://milonic.com/mm_menueditapi.js that we recommend you download and link to, rather than extract the functions.

This way it will ensure full compatibility, the functions taken from mm_menueditapi.js will constantly change and become incompatible with current and future versions but the functions contained within mm_menueditapi.js will change with the menu and always be compatible with the menu code files.
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

i added the edit js file as you suggested and was able to get it partially working again. It seems to work fine except for the errors.

http://www.makaro.com/milonic2/test.html

The error I get in firefox is:
when I hover over a menu:

Error: $H is not defined
Source File: file:///C:/milonicTest/test.html
Line: 32

note that in test.html I have:

function displaySubMenu() {
mm_createNewMenus();
$H(currentItem);
}

If I comment out the $H line above then the sub menu will not pop up.
currentItem = _itemRef; in test.html

Troy
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

Can you please change $H to $W

I think $H conflicts with prototype.js and was changed a while back.


Function should look like this:

Code: Select all

function displaySubMenu() { 
mm_createNewMenus(); 
$W(currentItem); 
} 
Cheers,
Andy
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

ok, now I'm back to my original error. Try it at: http://www.makaro.com/milonic2/test.html
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Has this code ever worked before?
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

I just created the code a day before my original post with the noted older version. Now I have upgraded to the newest version and have the same error. If it helps, the error I am getting from IE7 is:

line: 21
Char: 10328
Error: '25' is null or not an object
Code: 0:
URL: http://www.makaro.com/milonic2/test.html
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

hi, I haven't heard back from anyone so I am just curious, Is anyone working on this problem since my last post? Am I going through the right channel as a registered user?
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Can you please confirm if the code you are using has ever worked before or is this something you are working on trying to get to work?

Also, looks like the code you are using is custom built, is this something you are personally working on?

Also, why are you doing things this way? Seems a little inefficient.
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

Hi, i doubt this code ever worked. It is something I tried a very long time ago but scrapped because it used to get the sub menu data from the server using an iframe but I found this caused the back button to stop working.

The concept of getting the submenu data from the server is still scrapped. Only the concept of deferring the submenu initialization is what I am attempting now.

The rdemo2_menu.js file that is in the demo I showed you is actually shortened by quite a bit but normally it has thousands of sub menus. IE was taking as much as 4 seconds just to process all those sub menus up front. This makes going from web page to web page brutally slow.

If you look at rdemo2_menu.js now, each sub menu is wrapped in its own method and will not be processed until I hover over the menu option. This change to defer the sub menu javascript processing until it is actually requested by the user has made the pages load instantly now.

This is a massive performance increase!!!!

As I hover over the submenu option, the individual submenu function is called. Each submenu function will first call isMenuLoaded() and will exit the function if the menu has already been loaded. Next the function creates a menuname object and then calls the displaySubMenu() function.

Notice the in rdemo2_menu.js that the first horizontal menu option row is not surrounded in their own methods and is instead processed as the page is loaded like normally suggested.

Troy
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

Can your pages use AJAX?

If they can, we have some good news. We hope to be able to provide an AJAX version of our menus some time this week.

Can you please let me know what Server Side Scripting language you have access to?

Cheers,
Andy
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

Ajax is just a way of asychronously using javascript to access your server and refresh only parts of a web page. I really don't need this because I already have all the menu options in a js file that is cached by the users browser.

As long as the browsers don't pop up a window with the error, the example I gave you works fine. I just need the error to be supressed.

I'm using java 1.5 servlets with tomcat.

Troy
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

This has taken me ages to find the bug, think I've got it now though.

The fix is in the new Pre Release available from http://milonic.com/menuvinfo.php

Also, I recomend you use _popi(currentItem); instead of c_openMenu(currentItem); in your JavaScript

Hope this helps,
Andy
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

Yippie! You da man! It works great. Thanks
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

darn, I found another problem. It seems the submenus popup and don't close.

As I hover over a sub menu the onfunction method calls the proper method to create and display the sub menu.

All works great until I hover over a bunch of sub menus at once.

Try this in my example at http://www.makaro.com/milonic/test.html
hover over the 'sub menu 1', next move the mouse pointer over all the sub menus quickly and stop on submenu8 at the bottom.

I have set menuopendely=2000 to exagerate the effect. You will shortly notice all the submenus pop up and stay up.

Now, move the mouse pointer off of the menus and repeat the above step. You should notice that this time everything works as expected and only the last submenu8 menu pops up.

Troy
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Do you actually need the open delay?
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

I know why it's doing this. Seems that the global variable that contains the menu to open is not being reset. Worse still, the variable is being cloned and opening all menus it's been told to.

This is probably because the menus are inside their own function and the variable is being given it's own memory allocation and this is why it cannot be reset.

I'll keep trying for a workaround
tmakaro
Advanced
Advanced
Posts: 25
Joined: Thu Jan 26, 2006 10:43 pm

Post by tmakaro »

our open delay is usually set to 120. I set it temporarily to 2000 to exagerate the problem for you. I also just now tried setting it to 0 and the problem still exists although not as badly as when it is set to 120.
Post Reply