XMLHTTP+Javascript+Asp寫得聊天室,無重新整理實現(一)

來源:互聯網
上載者:User
javascript|xml|聊天室|重新整理|無重新整理
  使用XML.而無須不斷重新整理*.ASP.
無重新整理實現發言的逐條顯示.
使用Application變數儲存聊天記錄,所以要需要建立一個虛擬目錄
伺服器端不需要支援XML,只要支援ASP和能建立虛擬目錄就可以了.
以下代碼在nt4.0+iis4.0上通過.我估計在你的win2000下也差不多吧.
如果有問題,請多多賜教:netnice@chinaok.net

##########index.asp##############################

<html>
<head>
<title>藍蝶聊天室 Www.ChinaOk.net</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style TYPE="text/css">
BODY{FONT-SIZE: 9pt}
TD{FONT-SIZE: 9pt}
.tbljm{BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid;color:#000000;}
</style>
<script language="Javascript">
function openWin()
{winst="Status=yes,scrollbars=yes,resizable=yes,width="+(screen.availWidth-10)+",height="+(screen.availHeight-50)+",top=0,left=0";
window.open('about:blank','7923sdfsdfs',winst);
}
function form_onsubmit(obj)
{ var no=0,psd="1234567890";
if(obj.UserName.value==""){alert("請輸入你的暱稱!\n"); obj.UserName.focus(); return false;}
if(obj.UserName.value.indexOf(" ")>-1 ||obj.UserName.value.indexOf("'")>-1 || obj.UserName.value.indexOf("\"")>-1){alert("你的暱稱含有非法字元!\n"); obj.UserName.focus(); return false;}
openWin();
return true;
}
</script>
</head>

<body bgcolor="#ffffff" text="#000000" valign="center" onload="javascript:document.form1.ok.blur()" background="images/greystrip.gif">
<center><TABLE border=0 width="67%">
<TBODY>
<TR>
<TD valign=center align="middle" style="FONT-SIZE: 10.5pt"><FONT color=#0033ff>::::: :::::</FONT> </TD>
</TR></TBODY></TABLE></center>
<table width="200" border="0" style="BORDER-RIGHT: #003366 1px solid; BORDER-TOP: #003366 1px solid; BORDER-LEFT: #003366 1px solid; BORDER-BOTTOM: #003366 1px solid" cellspacing="0" cellpadding="0" align="center">
<tr>
<td bgcolor="#304d7c" height="25">
<div align="center"><font color="#ffffff">使用者登陸</font></div>
</td>
</tr>
<tr>
<td height="121">
<form name="form1" method="post" action="main.asp" onSubmit="return form_onsubmit(this)" target="7923sdfsdfs">

<table width="199" border="0" cellspacing="0" cellpadding="0" background="images/greystrip.gif">
<tr>
<td height="35">
<div align="center">使用者名稱:
<input name="UserName" size="10" maxlength="20" class=tbljm>
</div>
</td>
</tr>
<tr>
<td height="41">
<div align="center">性  別:
<input type=radio value="0" name=sx checked>男 | <input type="radio" value="1" name=sx>女
</div>
</td>
</tr>
<tr>
<td height="40">
<div align="center">
<input type="submit" name="ok" value="登 陸" class=tbljm>
<input type="reset" name="nook" value="重 寫" class=tbljm><BR><br><font color=red>示範xmlHttp實現的無重新整理技術<br>代碼可下載</font><br></div>
</td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.