不用帧结构,进入不同页面时会刷新页面,怎么保留树形菜单的展开状态,就是要知道自己所在页面是那部分。代码如下
surfmap.js
//
-----------------------------------------------------------------------
-----
// Private section.
//
// The variables and functions in this section are used internally by
the script
// and shouldn't be accessed directly from outside.
//
-----------------------------------------------------------------------
-----
// Global variables
var items = new Array(); // array of all items in
the sitemap
var topItems = new Array(); // top level items only
var browser = "OTHER"; // browser version (IE,
NS or OTHER)
var selectedItem = null; // current selected item
var style = null; // site map style
var scriptURL = null; // URL to the script
folder
var expandTopItems = null; // true to expand top
level items
var mouseOverColor = "#FFFFFF"; // mouse over color
var selectedColor = "#FFFFFF"; // selected color
var selectedBackground = null; // selected background
color
//
-----------------------------------------------------------------------
-----
// Calculates the Y coordinates of all visible sitemap items.
//
-----------------------------------------------------------------------
-----
function adjustY()
{
if ( browser != "NS" )
return;
var y = 0;
var minWidth = 0;
var minHeight = 0;
for ( var i=0; i
1<items.length; (="" )="" +="items[i].obj.clip.height;" i++="" if="" items[i].obj.clip.width="" items[i].obj.left="0;" items[i].obj.top="y;" items[i].obj.visibility="show" y="" {=""> minWidth )
2minWidth = items[i].obj.clip.width;
3minHeight += items[i].obj.clip.height;
4}
5}
6document.sitemap.clip.right = minWidth;
7document.sitemap.clip.bottom = minHeight;
8}
9
10
11
12//
13
14\-----------------------------------------------------------------------
15
16\-----
17// Colapses a given item, hiding its entire subtree.
18//
19
20\-----------------------------------------------------------------------
21
22\-----
23function colapse( siteItem )
24{
25if ( selectedItem == siteItem )
26selectItem( null );
27for ( var i=0; i<siteitem.children.length; "<table="" (="" )="" );="" ;="" \-----="" \-----------------------------------------------------------------------="" _writeln(="" border="0" browser="IE" cellpadding="0" cellspacing="0" colapse(="" display()="" displays="" else="" function="" i++="" if="" siteitem.children[i]="" siteitem.children[i].obj.style.display="none" siteitem.children[i].obj.visibility="hide" sitemap="" style="position:relative; font-size: 9pt; font-family: 宋体; " the="" {="" }=""><tr><td align="left" valign="top">" );
28
29for ( var i=0; i<topitems.length; ""="" "<="" (="" )="" );="" _writeln(="" browser="IE" i++="" if="" renderitem(="" td="" topitems[i],=""></topitems.length;></td></tr>" );
30else if ( browser == "NS" )
31window.onResize = restoreIcons;
32else
33return;
34
35for ( var i=0; i<topItems.length; i++ )
36{
37var siteItem = topItems[i];
38if ( browser == "IE" )
39siteItem.obj.style.display = "block";
40else if ( browser == "NS" )
41siteItem.obj.visibility = "show";
42if ( (expandTopItems) && (siteItem.children.length != 0) )
43{
44expand( siteItem );
45siteItem.opened = true;
46updateIcons( siteItem );
47}
48}
49adjustY();
50}
51
52
53
54//
55
56\-----------------------------------------------------------------------
57
58\-----
59// Expands a given item, re
60\---------------------------------------------------------------
61
62
63var oRange=document.body.createTextRange();
64if (oRange.findText('这里是你的节点名称'))
65{oRange.select();}</siteitem.children.length;></items.length;>