Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:44
Error: _M has no properties ???
Poster: tmakaro
Dated: Wednesday January 10 2007 - 0:18:44 GMT
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
Poster: Ruth
Dated: Wednesday January 10 2007 - 1:10:23 GMT
Hi,
We can't help on this you are way downlevel on the menu. You need to upgrade to the newest version.
Ruth
Poster: tmakaro
Dated: Wednesday January 10 2007 - 21:03:07 GMT
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
}
}
}
Poster: Andy
Dated: Wednesday January 10 2007 - 22:31:23 GMT
Hi,
The functions you are using are actually included inside http://www.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.
Poster: tmakaro
Dated: Thursday January 11 2007 - 0:41:51 GMT
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
Poster: Andy
Dated: Thursday January 11 2007 - 16:46:07 GMT
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:
function displaySubMenu() {
mm_createNewMenus();
$W(currentItem);
}
mm_createNewMenus();
$W(currentItem);
}
Cheers,
Andy
Poster: tmakaro
Dated: Thursday January 11 2007 - 17:19:34 GMT
ok, now I'm back to my original error. Try it at: http://www.makaro.com/milonic2/test.html
Poster: tmakaro
Dated: Thursday January 11 2007 - 17:38:19 GMT
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
Poster: tmakaro
Dated: Thursday January 11 2007 - 22:09:19 GMT
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?
Poster: Andy
Dated: Friday January 12 2007 - 11:05:25 GMT
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.
Poster: tmakaro
Dated: Friday January 12 2007 - 14:20:31 GMT
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
Poster: Andy
Dated: Sunday January 14 2007 - 19:43:12 GMT
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
Poster: tmakaro
Dated: Sunday January 14 2007 - 22:46:17 GMT
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
Poster: Andy
Dated: Tuesday January 16 2007 - 16:26:00 GMT
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://www.milonic.com/menuvinfo.php
Also, I recomend you use _popi(currentItem); instead of c_openMenu(currentItem); in your JavaScript
Hope this helps,
Andy
Poster: tmakaro
Dated: Wednesday January 17 2007 - 0:37:12 GMT
Yippie! You da man! It works great. Thanks
Poster: tmakaro
Dated: Wednesday January 17 2007 - 19:19:49 GMT
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
Poster: Andy
Dated: Wednesday January 17 2007 - 23:25:15 GMT
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
Poster: tmakaro
Dated: Wednesday January 17 2007 - 23:26:40 GMT
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.
Poster: Andy
Dated: Thursday January 18 2007 - 11:38:37 GMT
This bug wa a good one, had me going for hours
Anyway, think I got it, can you please try the Pre Release version at http://www.milonic.com/menuvinfo.php
Cheers,
Andy