思路:母版頁隱藏控件 從内容頁接收值 JS根據接受的值控制菜單項的現實母版頁:隱藏控件: 复制代码 代码如下: JS: <BR> var X = document.getElementById('<%=this.Lbl_X.ClientID %>').innerText;<BR> var Xn = document.getElementById('<%=this.Lbl_Xn.ClientID %>').innerText;<BR> var div = document.getElementById(X);<BR> if (div != null) {<BR> div.setAttribute("class", 'nav-top-item current');<BR> }<BR> var div2 = document.getElementById(Xn);<BR> if (div != null) {<BR> div2.setAttribute("class", 'current');<BR> }<BR> 内容頁給母版頁隱藏空間賦值: //設置母版頁Lable的值,以控制菜單項CSS 复制代码 代码如下: Label X = (Label)this.Master.FindControl("Lbl_X"); X.Text = "A"; Label Xn = (Label)this.Master.FindControl("Lbl_Xn"); Xn.Text = "A1";