通用js文件,保持2级菜单刷新后显示
1<!--
2//LoginOut
3function logOut()
4{
5 if (confirm("Are you sure to close?"))
6 {
7 window.parent.opener = false ;
8 window.parent.close() ;
9 }
10}
11
12function ShowSmallMenu(spnSmallMenu)
13{
14 document.all.spnSmallmenuA.style.display = "none";
15 document.all.spnSmallmenuB.style.display = "none";
16 document.all.spnSmallmenuC.style.display = "none";
17 document.all.spnSmallmenuD.style.display = "none";
18 document.all.tdEstimate.background="../img/BG_BigMenu.GIF";
19 document.all.tdOrder.background="../img/BG_BigMenu.GIF";
20 document.all.tdDelivery.background="../img/BG_BigMenu.GIF";
21 document.all.tdDesire.background="../img/BG_BigMenu.GIF";
22
23 document.all.tdEstimate.style.color="#000000";
24 document.all.tdOrder.style.color="#000000";
25 document.all.tdDelivery.style.color="#000000";
26 document.all.tdDesire.style.color="#000000";
27
28 switch(spnSmallMenu)
29 {
30
31 case "spnSmallmenuA":
32 document.all.spnSmallmenuA.style.display="block";
33 document.all.tdEstimate.background="../img/BG_BigMenuPress.GIF";
34 document.all.tdEstimate.style.color="#FFFFFF";
35 break;
36
37 case "spnSmallmenuB":
38 document.all.spnSmallmenuB.style.display = "block";
39 document.all.tdOrder.background="../img/BG_BigMenuPress.GIF";
40 document.all.tdOrder.style.color="#FFFFFF";
41 break;
42
43 case "spnSmallmenuC":
44 document.all.spnSmallmenuC.style.display = "block";
45 document.all.tdDelivery.background="../img/BG_BigMenuPress.GIF";
46 document.all.tdDelivery.style.color="#FFFFFF";
47 break;
48
49 case "spnSmallmenuD":
50 document.all.spnSmallmenuD.style.display = "block";
51 document.all.tdDesire.background="../img/BG_BigMenuPress.GIF";
52 document.all.tdDesire.style.color="#FFFFFF";
53 break;
54
55 default:
56
57 }
58
59}
60
61var index=document.location.pathname.lastIndexOf(".");
62var formID=document.location.pathname.substr(index-7,7);
63window.QueryString = new QueryString();
64window.QueryString.Read();
65
66function window_onload(){
67 try{
68 KeepMenu(formID);
69 document.all.spnFormID.innerText=formID + document.all.spnFormID.innerText;
70
71 var flag=window.QueryString.GetValue("flag");
72
73 if (flag=="on"){
74 document.getElementById("SRB2100on").style.textDecorationUnderline = true;
75 }
76 if (flag=="off"){
77 document.getElementById("SRB2100off").style.textDecorationUnderline = true;
78 }
79
80 document.getElementById(formID).style.textDecorationUnderline = true;
81
82 }
83 catch(e){}
84}
85window.attachEvent("onload",window_onload);
86
87
88function KeepMenu(formID)
89{
90 switch (formID)
91 {
92
93 case "SRB0000":
94 case "SRB1000":
95 ShowSmallMenu("spnSmallmenuA");
96 break;
97
98 case "SRB2100":
99 case "SRB2410":
100 case "SRB2200":
101 ShowSmallMenu("spnSmallmenuB");
102 break;
103
104 case "SRB3100":
105 case "SRB3110":
106 case "SRB3300":
107 ShowSmallMenu("spnSmallmenuC");
108 break;
109
110 case "SRB4110":
111 case "SRB4220":
112 ShowSmallMenu("spnSmallmenuD");
113 break;
114
115 default:
116 }
117}
2//LoginOut
3function logOut()
4{
5 if (confirm("Are you sure to close?"))
6 {
7 window.parent.opener = false ;
8 window.parent.close() ;
9 }
10}
11
12function ShowSmallMenu(spnSmallMenu)
13{
14 document.all.spnSmallmenuA.style.display = "none";
15 document.all.spnSmallmenuB.style.display = "none";
16 document.all.spnSmallmenuC.style.display = "none";
17 document.all.spnSmallmenuD.style.display = "none";
18 document.all.tdEstimate.background="../img/BG_BigMenu.GIF";
19 document.all.tdOrder.background="../img/BG_BigMenu.GIF";
20 document.all.tdDelivery.background="../img/BG_BigMenu.GIF";
21 document.all.tdDesire.background="../img/BG_BigMenu.GIF";
22
23 document.all.tdEstimate.style.color="#000000";
24 document.all.tdOrder.style.color="#000000";
25 document.all.tdDelivery.style.color="#000000";
26 document.all.tdDesire.style.color="#000000";
27
28 switch(spnSmallMenu)
29 {
30
31 case "spnSmallmenuA":
32 document.all.spnSmallmenuA.style.display="block";
33 document.all.tdEstimate.background="../img/BG_BigMenuPress.GIF";
34 document.all.tdEstimate.style.color="#FFFFFF";
35 break;
36
37 case "spnSmallmenuB":
38 document.all.spnSmallmenuB.style.display = "block";
39 document.all.tdOrder.background="../img/BG_BigMenuPress.GIF";
40 document.all.tdOrder.style.color="#FFFFFF";
41 break;
42
43 case "spnSmallmenuC":
44 document.all.spnSmallmenuC.style.display = "block";
45 document.all.tdDelivery.background="../img/BG_BigMenuPress.GIF";
46 document.all.tdDelivery.style.color="#FFFFFF";
47 break;
48
49 case "spnSmallmenuD":
50 document.all.spnSmallmenuD.style.display = "block";
51 document.all.tdDesire.background="../img/BG_BigMenuPress.GIF";
52 document.all.tdDesire.style.color="#FFFFFF";
53 break;
54
55 default:
56
57 }
58
59}
60
61var index=document.location.pathname.lastIndexOf(".");
62var formID=document.location.pathname.substr(index-7,7);
63window.QueryString = new QueryString();
64window.QueryString.Read();
65
66function window_onload(){
67 try{
68 KeepMenu(formID);
69 document.all.spnFormID.innerText=formID + document.all.spnFormID.innerText;
70
71 var flag=window.QueryString.GetValue("flag");
72
73 if (flag=="on"){
74 document.getElementById("SRB2100on").style.textDecorationUnderline = true;
75 }
76 if (flag=="off"){
77 document.getElementById("SRB2100off").style.textDecorationUnderline = true;
78 }
79
80 document.getElementById(formID).style.textDecorationUnderline = true;
81
82 }
83 catch(e){}
84}
85window.attachEvent("onload",window_onload);
86
87
88function KeepMenu(formID)
89{
90 switch (formID)
91 {
92
93 case "SRB0000":
94 case "SRB1000":
95 ShowSmallMenu("spnSmallmenuA");
96 break;
97
98 case "SRB2100":
99 case "SRB2410":
100 case "SRB2200":
101 ShowSmallMenu("spnSmallmenuB");
102 break;
103
104 case "SRB3100":
105 case "SRB3110":
106 case "SRB3300":
107 ShowSmallMenu("spnSmallmenuC");
108 break;
109
110 case "SRB4110":
111 case "SRB4220":
112 ShowSmallMenu("spnSmallmenuD");
113 break;
114
115 default:
116 }
117}
1/*
2 Copyright (c) 2000, Derek Petillo
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8
9 Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11
12 Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15
16 Neither the name of Praxis Software nor the names of its contributors
17 may be used to endorse or promote products derived from this software
18 without specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32*/
33function QueryString() {
34 var data = [];
35 this.Read = function()
36 {
37 var aPairs, aTmp;
38 var queryString = new String(window.location.search);
39 queryString = queryString.substr(1, queryString.length); //remove "?"
40 aPairs = queryString.split("&");
41
42 for (var i=0 ; i<aPairs.length; i++)
43 {
44 aTmp = aPairs[i].split("=");
45 data[aTmp[0]] = aTmp[1];
46 }
47 }
48
49 this.GetValue = function( key )
50 {
51 return data[key];
52 }
53 this.SetValue = function( key, value )
54 {
55 if (value == null)
56 delete data[key];
57 else
58 data[key] = value;
59 }
60 this.ToString = function()
61 {
62 var queryString = new String("");
63
64 for (var key in data)
65 {
66 if (queryString != "")
67 queryString += "&"
68 if (data[key])
69 queryString += key + "=" + data[key];
70 }
71 if (queryString.length > 0)
72 return "?" + queryString;
73 else
74 return queryString;
75 }
76 this.Clear = function()
77 {
78 delete data;
79 data = [];
80 }
81}
82
83
84function Cookies() {
85 var cookieData = [];
86
87 this.Read = function()
88 {
89 var pairs = new String(window.document.cookie).split(";");
90 var tmp, cookieName, keyName;
91 for (var i=0 ; i<pairs.length; i++)
92 {
93 tmp = pairs[i].split("=");
94
95 if (tmp.length == 3)
96 {
97 cookieName = new String(tmp[0]);
98 cookieName = cookieName.replace(" ", "");
99
100 if (cookieData[cookieName] == null)
101 cookieData[cookieName] = [];
102 cookieData[cookieName][tmp[1]] = unescape(tmp[1]);
103 }
104 else //length = 2
105 {
106 keyName = tmp[0];
107 keyName = keyName.replace(" ", "");
108 if (keyName.substring(0,12)!="ASPSESSIONID")
109 {
110 if (cookieData[""] == null)
111 cookieData[""] = [];
112 cookieData[""][keyName] = unescape(tmp[1]);
113 }
114 }
115 }
116
117 }
118
119 this.GetValue = function( cookie, key )
120 {
121 if (cookieData[cookie] != null)
122 return cookieData[cookie][key];
123 else
124 return null;
125 }
126 this.SetValue = function( cookie, key, value )
127 {
128 if (cookieData[cookie] == null)
129 cookieData[cookie] = [];
130 cookieData[cookie][key] = value;
131 }
132 this.Write = function()
133 {
134
135 var toWrite;
136 var thisCookie;
137 var expireDateKill = new Date();
138 var expireDate = new Date();
139 expireDate.setYear(expireDate.getFullYear() + 10);
140 expireDateKill.setYear(expireDateKill.getFullYear() - 10);
141
142
143 var pairs = new String(window.document.cookie).split(";");
144 var tmp, cookieName, keyName;
145 for (var i=0 ; i<pairs.length; i++)
146 {
147 tmp = pairs[i].split("=");
148 if (tmp.length == 3)
149 {
150 window.document.cookie = tmp[0] + "=" + tmp[1] + "='';expires=" + expireDateKill.toGMTString();
151 }
152 else
153 {
154 keyName = tmp[0];
155 keyName = keyName.replace(" ", "");
156 if (keyName.substring(0,12)!="ASPSESSIONID")
157 window.document.cookie = keyName + "='';expires=" + expireDateKill.toGMTString();
158 }
159 }
160
161 for (var cookie in cookieData)
162 {
163 toWrite = "";
164 thisCookie = cookieData[cookie];
165 for (var key in thisCookie)
166 {
167 if (thisCookie[key] != null)
168 {
169 if (cookie == "")
170 toWrite = key + "=" + thisCookie[key];
171 else
172 toWrite = cookie + "=" + key + "=" + escape(thisCookie[key]);
173 toWrite += "; expires=" + expireDate.toGMTString();
174 window.document.cookie = toWrite;
175 }
176 }
177 }
178 }
179}
180
2 Copyright (c) 2000, Derek Petillo
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8
9 Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11
12 Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15
16 Neither the name of Praxis Software nor the names of its contributors
17 may be used to endorse or promote products derived from this software
18 without specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32*/
33function QueryString() {
34 var data = [];
35 this.Read = function()
36 {
37 var aPairs, aTmp;
38 var queryString = new String(window.location.search);
39 queryString = queryString.substr(1, queryString.length); //remove "?"
40 aPairs = queryString.split("&");
41
42 for (var i=0 ; i<aPairs.length; i++)
43 {
44 aTmp = aPairs[i].split("=");
45 data[aTmp[0]] = aTmp[1];
46 }
47 }
48
49 this.GetValue = function( key )
50 {
51 return data[key];
52 }
53 this.SetValue = function( key, value )
54 {
55 if (value == null)
56 delete data[key];
57 else
58 data[key] = value;
59 }
60 this.ToString = function()
61 {
62 var queryString = new String("");
63
64 for (var key in data)
65 {
66 if (queryString != "")
67 queryString += "&"
68 if (data[key])
69 queryString += key + "=" + data[key];
70 }
71 if (queryString.length > 0)
72 return "?" + queryString;
73 else
74 return queryString;
75 }
76 this.Clear = function()
77 {
78 delete data;
79 data = [];
80 }
81}
82
83
84function Cookies() {
85 var cookieData = [];
86
87 this.Read = function()
88 {
89 var pairs = new String(window.document.cookie).split(";");
90 var tmp, cookieName, keyName;
91 for (var i=0 ; i<pairs.length; i++)
92 {
93 tmp = pairs[i].split("=");
94
95 if (tmp.length == 3)
96 {
97 cookieName = new String(tmp[0]);
98 cookieName = cookieName.replace(" ", "");
99
100 if (cookieData[cookieName] == null)
101 cookieData[cookieName] = [];
102 cookieData[cookieName][tmp[1]] = unescape(tmp[1]);
103 }
104 else //length = 2
105 {
106 keyName = tmp[0];
107 keyName = keyName.replace(" ", "");
108 if (keyName.substring(0,12)!="ASPSESSIONID")
109 {
110 if (cookieData[""] == null)
111 cookieData[""] = [];
112 cookieData[""][keyName] = unescape(tmp[1]);
113 }
114 }
115 }
116
117 }
118
119 this.GetValue = function( cookie, key )
120 {
121 if (cookieData[cookie] != null)
122 return cookieData[cookie][key];
123 else
124 return null;
125 }
126 this.SetValue = function( cookie, key, value )
127 {
128 if (cookieData[cookie] == null)
129 cookieData[cookie] = [];
130 cookieData[cookie][key] = value;
131 }
132 this.Write = function()
133 {
134
135 var toWrite;
136 var thisCookie;
137 var expireDateKill = new Date();
138 var expireDate = new Date();
139 expireDate.setYear(expireDate.getFullYear() + 10);
140 expireDateKill.setYear(expireDateKill.getFullYear() - 10);
141
142
143 var pairs = new String(window.document.cookie).split(";");
144 var tmp, cookieName, keyName;
145 for (var i=0 ; i<pairs.length; i++)
146 {
147 tmp = pairs[i].split("=");
148 if (tmp.length == 3)
149 {
150 window.document.cookie = tmp[0] + "=" + tmp[1] + "='';expires=" + expireDateKill.toGMTString();
151 }
152 else
153 {
154 keyName = tmp[0];
155 keyName = keyName.replace(" ", "");
156 if (keyName.substring(0,12)!="ASPSESSIONID")
157 window.document.cookie = keyName + "='';expires=" + expireDateKill.toGMTString();
158 }
159 }
160
161 for (var cookie in cookieData)
162 {
163 toWrite = "";
164 thisCookie = cookieData[cookie];
165 for (var key in thisCookie)
166 {
167 if (thisCookie[key] != null)
168 {
169 if (cookie == "")
170 toWrite = key + "=" + thisCookie[key];
171 else
172 toWrite = cookie + "=" + key + "=" + escape(thisCookie[key]);
173 toWrite += "; expires=" + expireDate.toGMTString();
174 window.document.cookie = toWrite;
175 }
176 }
177 }
178 }
179}
180