问题补充说明:实现点击链接没登录弹窗口直报错知道用隐藏text读取session内容JS:function mycom() { var aa = document.getElementById('sess').value;//sess用'<%=sess.ClientID%>'行 if (aa == "aa") { Response.Write("alert('请登陆')"); } else if (aa == "bb") { Response.Redirect("recommend.aspx"); } }台.csprotected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Label1.Visible = false; sess.Text = "bb"; } else if (Session["username"] != null) { Label2.Text = Session["username"].ToString(); sess.Text = "bb"; } }
sess服务器控件母版页html给ID加前缀说浏览器找id浏览器打按F12定位控件查看id修改js应值
标签:未定义,null,value