Finishing up

What is left is to add some code to the files that are to appear in the right frame (the content frame, in our example called "text"), and also checking all pages to make sure everything's right. Lets look at the code we need to add first.

The code is needed for the tracking. If you forget to insert this the tracking won't work. You'll also see that submenus with URLs will not work as they should. In the page-header (between <HEAD> and </HEAD>) you have to insert this little script:

<script type="text/javascript">
<!-- hide the script from old browsers

if((navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3 && navigator.userAgent.indexOf("Opera") == -1) || (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4)) {
  if(parent.frames['code'].MTMDisplayMenu != null) {
    parent.frames['code'].MTMTrack = true;
    setTimeout("parent.frames['code'].MTMDisplayMenu()", 250);
  }
}

// End of script hiding -->
</script>

This code checks what browser the visitor has, and if it's either of the ones who get the dynamic menu we call the function to update the menu, with a slight delay of 250ms to make fetching documents from the cache a little quicker.

That should be about all there is to do. If you've used my pages as a basis for your pages you might want to remember that I use style sheets for my pages, and that each page therefore has a stylesheet linked. This link needs to be removed if you don't use stylesheets.

If you find that the script doesn't work as it should, go through what you've done and make sure it looks like it should do. Also remember that the above script needs to be present in all pages that are to be loaded in the main frame ("text" in our example) for the tracking to work correctly.


Morten Wang <warnckew@online.no>
Last modified 1999-11-07 16:16