This sample page was created in reference to this thread in the "Help and Support for Version 5".
There are many potential uses for passing the _itemRef from one page to the next. This demo creates a text breadcrumb, similar to that on many large sites: You Are Here---> help/css/tutorialsTest the menu above to view output.
To implement the mm_passItemRef() function:
- Place the following code at the top of the menu_data.js file:
var mm_separator = " ~ "; var mm_selectionSequence = ""; function mm_openUrl(url) { url+="?"+_itemRef; window.location.href = url; } 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)); }
- Edit the var mm_separator = " "; Placing whatever symbols are preferred or just put in non-breaking line spaces
For example, if you want your output to be - home--> help--> css--> tutorials - you would put --> into the var mm_separator
var mm_separator = "--> ";
- In the items you want to initiate the function when clicked, code the aI with the following information
url=javascript:mm_openUrl('index.htm');
and add at the end of the aI string
clickfunction=mm_getSelectionSequence();");
- Place the following at the end of the menu_data.js file after the drawMenus();
mm_getSelectionSequence();
The resulting aI string would look something like thisaI("text=Test 1;url=javascript:mm_openUrl('index.htm');clickfunction=mm_getSelectionSequence();");
- Create a div id="selections" and place it where you want the text to be posted. The following is the div code for this demo. You can change the style properties and change the Menu selections: to the text you prefer.
<div id="selections" style="position: absolute; top: 105px; left: 10px; text-align: left; vertical-align: top; font-family: verdana; font-size: 10pt"> <b>Menu selections: </b><script language="javascript"> document.write(mm_selectionSequence)</script> </div>