PageSync
Along with the SelectedCaption parameter (which lets you choose a caption to be expanded when the menu first appears), you can use JavaScript to dynamically change the expanded caption (in compatible browsers). (This is similar to our PageSync feature, available in a number of Cool Focus applets, with the exception that in XPanel this feature only expands a caption - it cannot select a panel item.)

This can be useful in two situations in particular:

  • If you have a non-framed site, with XPanel in every page, you can use Caption Selection to open the menu to the correct caption in each page. (The steps below may be used instead, but Caption 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 XPanel.

    <script language="JavaScript">
    var timeid=0;
    function selectItem(i)
    {
    if (!window.main.document.XPanel) {timeid=setInterval("selectItem(" +i + ")", 500); return;}
    clearInterval(timeid);
    var loaded = window.main.document.XPanel.GetVariable("loaded") == "true";
    if (!loaded) {timeid = setInterval("selectItem(" + i + ")", 500);}
    else {clearInterval(timeid); window.main.document.XPanel.SetVariable("selectitem", i);}
    }
    </script>

  2. (a) If using frames, change the red text to the name of the frame containing XPanel. (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 XPanel links to, add this code to the <body> tag:
    onload="top.selectItem(1)"
    Change the 1 in the brackets to the index number of the XPanel caption that should be expanded whenever this page is open. For example, if the 4th caption on the menu should be expanded when this page opens, change the number to 4. If you're not sure what the number should be, you can open the datafile for the applet in a text editor to find the caption-number.

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