登陆页面index.aspx
<%@ page language="c#" debug="true" %>
<%
if(Request.Form["submit"] == "submit"){
Session["name"] = Request.Form["name"];
Response.Redirect("frame.aspx");
}
%>
<html>
<head>
<title>登陆页面</title>
</head>
<body>
<form action="index.aspx" method="post">
姓名:<input type="text" name="name">
<br>
<input type="submit" name="submit" value="submit" value="登陆">
</form>
</body>
</html>
-----------------------------------
框架页frame.aspx
<html>
<head>
<title>框架页面</title>
</head>
<frameset rows="*,100">
<frame src="display.aspx">
<frame src="message.aspx">
</frameset>
</html>
-----------------------------------
聊天记录显示页面display.aspx
<%@ page language="c#" debug="true" %>
<html>
<head>
<title>display</title>
<meta http-equiv="refresh" content="5;url=display.aspx">
<script language="javascript">
function scrollWindow(){
this.scroll(0,6500);
setTimeout("scrollWindow()",200);
}
scrollWindow();
</script>
</head>
<body>
<%
Response.Write(Application["chat_content"]);
%>
</body>
</html>
-----------------------------------
发言页面:message.aspx
<%@ page language="c#" debug="true" %>
<%
string message = Request.Form["message"];
string chat_content = Session["name"]+"说:"+message;
Application.Lock();
Application["chat_content"] = Application["chat_content"] + "<br>" +chat_content;
Application.UnLock();
%>
<html>
<head>
<title>message</title>
</head>
<body bgcolor="lightblue" onload="document.all.message.focus();">
<form method="post" action="message.aspx" style="margin:0px;">
<input type="text" name="message" size="50">
<input type="submit">
</form>
</body>
</html>
<%@ page language="c#" debug="true" %>
<%
if(Request.Form["submit"] == "submit"){
Session["name"] = Request.Form["name"];
Response.Redirect("frame.aspx");
}
%>
<html>
<head>
<title>登陆页面</title>
</head>
<body>
<form action="index.aspx" method="post">
姓名:<input type="text" name="name">
<br>
<input type="submit" name="submit" value="submit" value="登陆">
</form>
</body>
</html>
-----------------------------------
框架页frame.aspx
<html>
<head>
<title>框架页面</title>
</head>
<frameset rows="*,100">
<frame src="display.aspx">
<frame src="message.aspx">
</frameset>
</html>
-----------------------------------
聊天记录显示页面display.aspx
<%@ page language="c#" debug="true" %>
<html>
<head>
<title>display</title>
<meta http-equiv="refresh" content="5;url=display.aspx">
<script language="javascript">
function scrollWindow(){
this.scroll(0,6500);
setTimeout("scrollWindow()",200);
}
scrollWindow();
</script>
</head>
<body>
<%
Response.Write(Application["chat_content"]);
%>
</body>
</html>
-----------------------------------
发言页面:message.aspx
<%@ page language="c#" debug="true" %>
<%
string message = Request.Form["message"];
string chat_content = Session["name"]+"说:"+message;
Application.Lock();
Application["chat_content"] = Application["chat_content"] + "<br>" +chat_content;
Application.UnLock();
%>
<html>
<head>
<title>message</title>
</head>
<body bgcolor="lightblue" onload="document.all.message.focus();">
<form method="post" action="message.aspx" style="margin:0px;">
<input type="text" name="message" size="50">
<input type="submit">
</form>
</body>
</html>