Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:29

mm_passItemref.js -> Breadcrumbs code


Poster: gmester
Dated: Tuesday October 11 2005 - 22:29:32 BST

I have inserted the include lines in my html code

===========================================
<script type="text/javascript" src="tools/milonic/milonic_src.js"></script>

<script type="text/javascript">
<!--
if(ns4)_d.write("<scr"+"ipt language=javascript src=tools/milonic/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=javascript src=tools/milonic/mmenudom.js><\/scr"+"ipt>");
-->

</script>

<script language=Javascript src="tools/milonic/mm_passItemRef.js" type=text/javascript></script>
==============================================

and am using the mm_passItemref.js code downloaded from the Milonic site.

I am trying to use the breadcrumsb code listed in the mm_passItemRef() code but I keep getting the same error.

The error I get is '_m[..][1] is either null or not an object. If I edit the function and hard code a 1 into the line where '_m[1][1]' is called, then it picks up the right value. Obvously, I do not want to hard code anything, so how do I get the 'i = selectedItem;' to actually grab the selected item?

function mm_getSelectionSequence()
{
var selectedItem = location.search.slice(1);
var i = selectedItem;
do {
if (mm_selectionSequence == "")
mm_selectionSequence = _mi[i][1]; <- ERROR ON ITEM ****
else
mm_selectionSequence = _mi[i][1] + mm_separator + mm_selectionSequence;
i = getParentItemByItem(i);
} while (!isNaN(i));
}





I


Poster: gmester
Dated: Thursday October 13 2005 - 17:16:00 BST

http://support.milonic.com/demos/pass_i ... /index.htm

Here is the Milonic site for this feature.

Anyone use Breadcrumbs in this menu?

mm_passItemRef.js


Poster: ecg921 __at__ gmail.com
Dated: Friday October 14 2005 - 17:18:58 BST

Where did you get mm_passItemRef.js? I can't find it on the Milonic website.

Thanks,

Eric


Poster: Ruth
Dated: Wednesday November 2 2005 - 21:28:38 GMT

ecg921 __at__ gmail.com, it is in the download at the bottom of the demo page from the link provided by gmester. But, note my response below to gmester.

gmester are you getting that error when you go to the demo? I'm not getting any error there. If you are not getting an error when you go to the demo, download the mm_passItemRef.js file from there. I think I'll have to check and make sure, if something was fixed, that the new .js is in the download.

Ruth


Poster: kevin3442
Dated: Friday November 4 2005 - 6:38:38 GMT

Hi gmester,

It sounds to me like the selectedItem variable is not getting set in the following line of the function:

Code:
var selectedItem = location.search.slice(1);


mm_passItemRef.js contains two key functions:

mm_openUrl() is used to open a link from a menu item; the function is called when a menu item is clicked. The url that you want to open when the item is clicked is passed as a string to the function. The function then takes the item reference (an array index) for the clicked item and appends it to the url string before opening the new page. That way, the old page can "tell" the new page which menu item was clicked. This is necessary because once the original page is gone, so is its javascript and any variable values that were stored with the page; when the new page loads, the menu script is loaded anew, and all variables are at their default values (no clicking has yet occurred on the new page).

When the new page opens, mm_getSelectionSequence() runs (it's called at the bottom of the menu_data code). The first thing the function does is parse (using the slice method) the menu item reference out of the url string, so that it knows what menu item was clicked to get to that page. Then, it works its way back from the selected item, through the menu hierarchy, building the breadcrum text as it goes.

Whew...

The upshot is, mm_getSelectionSequence() will only work if it "knows" what item was clicked on the previous page to get to the current page. The way the demo was set up, the clicked item reference is passed from page to page using the mm_openUrl() function. Are you using that function to open your pages?

Hope that made sense,

Kevin