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:14
Error in breadcrumbs demo _mi[i] is undefined
Poster: raemacleman
Dated: Wednesday December 3 2008 - 16:51:45 GMT
Hi,
My aim is to build in the text breadcrumbs functionality as outlined in the mm_passItemRef demo in your support area. Trying the demo with Firefox 3 yields an error (and no breadcrumbs) - "_mi[i] is undefined" and the line it highlights is ...
function mm_getSelectionSequence()
{
var selectedItem = location.search.slice(1);
var i = selectedItem;
do {
if (mm_selectionSequence == "")
mm_selectionSequence = _mi[i][1]; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
else
mm_selectionSequence = _mi[i][1] + mm_separator + mm_selectionSequence;
i = getParentItemByItem(i);
} while (!isNaN(i));
}
I've followed the 'recipe' exactly, locally, and get (a) no breadcrumbs and (b) the same error.
Can anyone help, please? I have a deadline looming and if I can't get this working it'll take all week to code by hand!
Kind regards
Re: Error in breadcrumbs demo _mi[i] is undefined
Poster: Ruth
Dated: Wednesday December 3 2008 - 21:26:14 GMT
Hi,
I think I fixed it. At least it seems to work in IE6, NN7.2, 9.0.0.5, FF1.5, 2.0.0.18, 3.0.1
It seems that for this and also the similar 'breadcrumbs' function demo, it is necessary to add a clickfunction to the aI, so the following
Code:
aI("text=Test 1;showmenu=Test1;url=javascript:mm_openUrl('index.htm');");
needs to be changed to
EDIT 8:38pm 12/03: Sorry I made a mistake which I have now corrected in the following code
Code:
aI("text=Test 1;showmenu=Test1;url=javascript:mm_openUrl('index.htm');clickfunction mm_getSelectionSequence();");
I have not yet updated the directions page, but wanted to post and give you the info on how to do it. I don't do functions or js, so though it works, I'm still getting the mi has no properties, or is undefined. I am going to post and ask Milonic about this. But whatever it is, it is not interferring with the operation of the function as far as I can tell, just giving the error message.
Hope this helps
Ruth
Re: Error in breadcrumbs demo _mi[i] is undefined
Poster: raemacleman
Dated: Thursday December 4 2008 - 4:52:33 GMT
Ruth,
Thank you for this, but it doesn't actually work either. One variation of your syntax which works for me is this...
Code:
url=javascript:mm_openUrl('/photo-album.html');clickfunction=mm_getSelectionSequence();");
... and now it works!
However, it doesn't actually write links (my interpretation of 'breadcrumbs' is that you can click on the breadcrumb link to move back to that page rather than going through the menu). Is there some function or similar tool which will write breadcrumb LINKS? i.e.
Code:
<a href="top.html">Top Level</a> >> <a href="second.html">Second Level</a>
rather than
Top Level >> Second Level
Kind regards
--
Re: Error in breadcrumbs demo _mi[i] is undefined
Poster: raemacleman
Dated: Thursday December 4 2008 - 4:54:56 GMT
Sorry,
For some reason I read your earlier version before it was amended. On looking again the code sample had been refreshed.
Kind regards
Rae MacLeman
--
Re: Error in breadcrumbs demo _mi[i] is undefined
Poster: raemacleman
Dated: Thursday December 4 2008 - 5:19:07 GMT
Ruth,
Having thought about this for a bit, it appears that I could write out breadcrumb links by taking the string returned in mm_selectionSequence, splitting it, then getting the url for each menu item text and then re-writing the string with the urls added.
Are there functions which would allow me to recover the url from the item text?
Kind regards
Rae MacLeman
Re: Error in breadcrumbs demo _mi[i] is undefined
Poster: Ruth
Dated: Thursday December 4 2008 - 6:10:24 GMT
Hi Rae,
I have not a clue. I really don't know anything about functions or creating them. Usually when I figure out a fix it's only because I just tried this, that and the other and luckily something clicked. But, I would guess there are such things since we have those functions that Kevin wrote that appear on the demos page. I have posted to Milonic to ask them about it, and there is the following information which may help you.
There is also a page with 'methods and functions' that might give you some info
http://www.milonic.com/menu_methods.php
And, I remember a post by Kevin a very long time ago something about dynamically changing urls and he did a very detailed explantion of item reference # for each part of an item, so maybe that will help you, also
viewtopic.php?p=14348
Hope something here is helpful.
EDIT: and i will see if I can figure out how to have the breadcrumb be a link, that would be great
Ruth