收集的网上用的ajax之chat.js文件

2019-06-02 23:22:39刘景俊

var response = xmlHttp.responseText;
document.getElementById("onlineuser").innerHTML = response;
}
}

function readset(){
  document.getElementById('layer_ichatset').style.display='block';

  var url = "../ichat/myset.asp?pid=" +Math.random();
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = showset;
  xmlHttp.send(null);

}

function showset() {
if (xmlHttp.readyState == 4) {
var response = xmlHttp.responseText;
document.getElementById("setplan").innerHTML = response;
}
}

function setsendto(username) {
if (username=="所有人"){
document.getElementById("sendto").value = '';
document.getElementById("talkwith").innerHTML = '所有成员';
}else{
document.getElementById("sendto").value = username;
document.getElementById("talkwith").innerHTML = username;
}
  var url = "../ichat/checkuser.asp?user="+ escape(username) + "&pid=" +Math.random();
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = showtips;
  xmlHttp.send(null);
}

function showtips() {
if (xmlHttp.readyState == 4) {
var response = xmlHttp.responseText;
document.getElementById("userstate").innerHTML = response;
}
}

function clearlog() {

if (window.confirm("您确定需要清除所有聊天记录吗?")==true)
{
var url = "../ichat/clearlog.asp?pid=" +Math.random();
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}

}


var ichatwinstate
ichatwinstate="max";

function min()
{
ichatwinstate = (ichatwinstate=="max")?"min":"max"

if (ichatwinstate=="min"){
document.getElementById('mbody').style.display='none';
document.getElementById('myichat').height= parseInt(document.getElementById('ichat_title').height);
document.getElementById('myichat').style.top = document.body.clientHeight - parseInt(document.getElementById("ichat_title").style.height) + document.body.scrollTop;
}else{
document.getElementById('mbody').style.display='block';
iresize();
}
}


function closeit(){
document.getElementById('myichat').style.display='none';
}


function iresize(){
if (ichatwinstate=="min"){
document.getElementById('myichat').style.top = document.body.clientHeight - parseInt(document.getElementById("ichat_title").style.height) + document.body.scrollTop - 1;
}else{
document.getElementById('myichat').style.top = document.body.clientHeight  + document.body.scrollTop - parseInt(document.getElementById("mbody").style.height) -85;