<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="default.css" rel="stylesheet" type="text/css">
</head>
<body>
<script charset="gb2312" language="javascript" src="div.js" type="text/javascript"></script>
<script charset="gb2312">
create("c",320,300,200,200,"test1","test2")
</script>
<script charset="gb2312" src="xmlhttp.js" type="text/javascript" language="javascript"></script>
<script charset="gb2312">
var nc;
function err()
{
//alert("error")
}
window.onerror=err
function onlinenum()
{
setTimeout("onlinenum()",2000)
loadXML("get","online.asp",onlinenumok)
}
function nc1()
{
var date=new Date()
var mo=String(date.getMonth())
var d=String(date.getDay())
var h=String(date.getHours())
var mi=String(date.getMinutes())
var s=String(date.getSeconds())
nc="lj"+mo+d+h+mi+s
}
function login()
{
nc1();
//alert(nc)
document.getElementById("name1").value=nc
loadXML("get","login.asp?nc="+nc,loginok)
//alert(nc)
}
function loginok(xmldom)
{
//alert(xmldom.responseText)
}
login()
onlinenum()
setInterval("getchat()",500)
window.onload=resize
window.onunload=exit
window.onresize=resize
window.onsccoll=resize
function onlinenumok(xmldom)
{
document.getElementById("num").innerHTML=xmldom.responseText
}
function dosub()
{
var e=document.getElementById("content")
var str=e.value
e.value=""
if(str=="")
{
alert("请输入内容")
}
else{
loadXML("get","send.asp?nc="+nc+"&content="+str,dosubok)
}
}
function dosubok()
{
}
function getchat()
{
if(document.getElementById("chatmain").contentWindow.document.body)
{
loadXML("GET","getChat.asp?nc="+nc,getChatOk);
}
else
{alert("no")}
//setTimeout("getchat()",1000)
}
function getChatOk(xmldom)
{
var str=""
var doc=xmldom.responseXML.getElementsByTagName("chatinfo")
for(i=0;i<doc.length;i++)
{
var nc=doc[i].childNodes[0].firstChild.data
var msgcont=doc[i].childNodes[1].firstChild.data
var datetime=doc[i].childNodes[2].firstChild.data
str=str+nc+" 说:"+" "+msgcont+" "+datetime+"<br/>"
//alert(nc)
}
if(doc.length>0){
document.getElementById("chatmain").contentWindow.document.getElementById("word").innerHTML=str
}
document.getElementById("chatmain").contentWindow.document.body.scrollTop=document.getElementById("chatmain").contentWindow.document.body.scrollHeight;
}
function modify()
{
if(document.getElementById("name1").value=="")
{
alert("请输入内容")
}
else
{
loadXML("get","modify.asp?nc="+nc+"&newnc="+document.getElementById("name1").value,modifyok)
}
}
function modifyok(xmldom)
{
document.getElementById("name1").value=xmldom.responseText
nc=xmldom.responseText
}
function exit()
{
loadXML("get","exit.asp?nc="+nc,exitok)
}
function exitok()
{
}
function resize()
{
divheight=document.getElementById("chat").offsetHeight
divwidth=document.getElementById("chat").offsetWidth
document.getElementById("chat").style.top=(document.body.clientHeight - divheight + parseInt(document.documentElement.scrollTop,10))+"px";
document.getElementById("chat").nextSibling.style.top=document.getElementById("chat").style.top
//alert(document.getElementById("chat").style.top)
document.getElementById("chat").style.left=(document.body.clientWidth - divwidth + parseInt(document.documentElement.scrollLeft,10))+"px";
document.getElementById("chat").nextSibling.style.left=document.getElementById("chat").style.left
}
</script>
</body>
</html>