A sitemap is very convenient on any website. With a bit of JavaScript, this feature can get even better. If you open a sitemap in a new window, you of course want all the links in a sitemap to open up in the original window. Obviously, this can be done by setting the target attribute of all HTML links (or use <base target="..." />). However, one question remains: Which is the window name? One way to answer this question is to use JavaScript in the main window and set the window's name property: this.name = "mainWindow"; Another way is to use the sitemap and reference the opening window from there. This is done by the opener property of the window, which is set to the parent window of the current window (if there is any parent). The following code is the complete sitemap: The Sitemap (sitemapwindow.html; excerpt)
And this listing opens the sitemap: Opening the Sitemap (sitemap.html; excerpt)
|