登陆后鼠标移动到用户名上显示你的账号信息
index.aspx页面 <script> //判断浏览器返回结果 function createXMLHttpRequest() { if (window.ActiveXObject) {//IE浏览器 return new new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) {//非Ie浏览器 return new XMLHttpRequest(); } } var xhr; function ShowStudent(studetId) { //用户名不为空 if (studetId != "") { //发送地址 var url = "getStudent.aspx?userId=" + studetId; //获取XMLHttpRequest对象 xhr = createXMLHttpRequest(); //设置回调函数 xhr.onreadystatechange = df; //初始化XMLHttpRequest组件 xhr.open("get", url, true); //发送请求 xhr.send(null); } var dv = document.getElementById("logstudent"); dv.style.display = "block"; } function df() { //得到响应的内容XML var dom = xhr.responseXML; //姓名 document.getElementById("Name").innerHTML = dom.getElementsByTagName("StudentName")[0].firstChild.nodeValue; //性别 document.getElementById("Sex").innerHTML = dom.getElementsByTagName("Sex")[0].firstChild.nodeValue; document.getElementById("Phone").innerHTML = dom.getElementsByTagName("Phone")[0].firstChild.nodeValue; document.getElementById("Address").innerHTML = dom.getElementsByTagName("Address")[0].firstChild.nodeValue; document.getElementById("Email").innerHTML = dom.getElementsByTagName("Email")[0].firstChild.nodeValue; } function hiend() { var dv = document.getElementById("logstudent"); dv.style.display = "none"; } </script> <asp:Panel ID="pnologin" runat="server"> <div class="nologin"> <a href="#" >【免费注册】</a> <a href="Login.aspx">【登陆】</a> </div> </asp:Panel> <asp:Panel ID="plogin" runat="server"> <div id="login"> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">注销</asp:LinkButton> </div> <div class="postiondv" id="logstudent"> 学生姓名:<label id="Name"></label><br /> 性别:<label id="Sex"></label><br /> 手机号码:<label id="Phone"></label><br /> 家庭住址:<label id="Address"></label><br /> 邮箱:<label id="Email"></label><br /> </div> </asp:Panel> index后台cs部分