PageSync
Along with the SelectedCaption, SelectedItem and SelectedSubitem parameters (which let you choose items to be selected when the menu first appears), you can use JavaScript to dynamically change the selected items (in compatible browsers).

This can be useful in two situations in particular:

  • If you have a non-framed site, with Gridlock in every page, you can use Item Selection to open the menu to the correct caption in each page. (The steps below may be used instead, but Item Selection is more straightforward.)

  • If you have a frames-based site, you may want to change the selected caption dynamically, so that if users navigate by clicking HTML links in the pages, or using the Back button, the menu can be adjusted to expand a particular caption. To use this feature, follow the steps below.

  1. (a) If using frames, copy and paste this code into the <head> section of your framesetting web page (the web page which contains your <frame> and <frameset> tags, or your <iframe> control).

    (b) If not using frames, copy and paste this code into the <head> section of every page containing Gridlock.

    <script language="JavaScript">
    var timeid=0;
    function setSelection(s)
    {
    if (!window.main.document.Gridlock) {timeid=setInterval("setSelection('" +s + "')", 500); return;}
    clearInterval(timeid);
    var loaded = window.main.document.Gridlock.GetVariable("loaded") == "true";
    if (!loaded) {timeid = setInterval("setSelection('" + s + "')", 500);}
    else {clearInterval(timeid); window.main.document.Gridlock.SetVariable("select", s);}
    }
    </script>

  2. (a) If using frames, change the red text to the name of the frame containing Gridlock. (Remember that frame names are case-sensitive!)

    (b) If not using frames, delete the red text and the dot after it.

  3. If you changed the name of the applet in your HTML code, change the blue text to the new name you chose.

  4. In each page that Gridlock links to, add this code to the <body> tag:
    onload="top.setSelection('2-1-4')"
    Change the bold text to specify the caption, item and subitem to be selected. Note that each is separated by a hyphen: caption-item-subitem. Use a 0 for any level that shouldn't have a selection. For example, 0-0-0 would deselect all items.

    If you're not using frames, delete the red text (including the dot).