您的位置:首页 > 其它

批量判断QQ是否在线,强迫聊天

2010-10-26 10:21 246 查看
<!--

功能:批量判断QQ是否在线,强迫聊天

作者:胡成洪

时间: 2009-8-18

-->

<html >

<head>

<title>判断QQ在线</title>

<style type="text/css" >

ul li

{

list-style-type:none;

line-height:25px;height:25px; width:650px;

}

a{

color:blue;text-decoration: none;

}

a:hover {

color:red;text-decoration: none;

}

.clear

{

clear:both;

}

.qq_1

{

float:left;width:150px;margin:0px;line-height:25px;height:25px;

}

.qq_2

{

float:left;width:100px;margin:0px;line-height:25px;height:25px;color:red;

}

.qq_3

{

float:left;width:200px;margin:0px;line-height:25px;height:25px;

}

</style>

<SCRIPT type="text/javascript">

var online=new Array();

var QQList;

var QQImgs;

//添加script

function include(src) {

var s = document.createElement('script');

s.type="text/javascript";

s.src = src;

var tags = document.getElementsByTagName("head");

tags[0].appendChild(s);

}

function getQQlist()

{

var QQListString ="";

for(var i=0;i< QQList.length;i++)

{

QQListString += QQList[i].replace(/[/s]*/g,"") + ":";

}

include("http://webpresence.qq.com/getonline?Type=1
&" +QQListString +"&t="+Math.random());

getOnline();

}

function getOnline()

{

var mesDiv = document.getElementById("divQQList");

//如果还没有获得是否在线的数组,强行刷新在线QQ列表

if( online.length < QQList.length )

{

mesDiv.innerHTML="正在处理........"

QQtime = window.setTimeout("getOnline()",50);

return;

}else{

//获取后,清除定时器

if(typeof(QQtime)!='undefined' && QQtime!=null){

clearTimeout(QQtime);

}

setQQlistHtml();

}

}

function setQQlistHtml(){

var strHtml ="<ul >";

for(var i=0;i< QQList.length;i++)

{

var strOnline="";

var strMsg = "";

if(online[i]==1)

{

var strOnline="在线";

var strMsg = "你可以点击QQ号与他对话";

}else

{

var strOnline="不在线";

var strMsg = "你可以点击QQ号给他留言";

}

strHtml +=" <li><div class='qq_1'><a href='tencent://message/?uin="+QQList[i].replace(/[/s]*/g,"")+"&Site=cdnic.com.cn&Menu=yes&t="+Math.random()+"' id='qqNum_"+ i +"'>";

strHtml+="QQ:"+QQList[i].replace(/[/s]*/g,"")+"</a></div> <div class='qq_2'>"+ strOnline+" </div> <div class='qq_3'>";

strHtml+= strMsg + " </div></li>";

}

strHtml+="</ul>";

document.getElementById("divQQList").innerHTML=strHtml;

for(var i=0;i< QQList.length;i++)

{

if(online[i]==1)

{

var qqNum = document.getElementById("qqNum_"+i);

qqNum.style.color = "#ffffff" ;

setQQStyle(qqNum);

}

}

}

function setQQStyle(qq)

{

if(qq.style.color == "#ffffff" || qq.style.color == "rgb(255, 255, 255)" )

{

qq.style.color = "#ff0000";

}else{

qq.style.color = "#ffffff";

}

setTimeout(function(){setQQStyle(qq);},300);

}

function setQQList()

{

var qqs = document.getElementById("txtQQList").value;

if(qqs=="")

{

alert("请填写QQ");

return;

}

online=new Array();

QQList = qqs.split(',');

getQQlist();

}

</SCRIPT>

</head>

<body style="text-align:center">

<div style="width:800px; height:1%;line-height:25px; background-color:#E3EAEB;">

<div style="width:750px; height:30px; text-align:left; float:left; margin:30px auto 0px 30px; line-height:25px;">

请输入你要判断的QQ号,多个请用,号隔开。如 25423554,523453245

</div>

<div style="width:750px; height:30px; text-align:left; float:left; margin-left:30px; line-height:25px;">

<input type="text" id="txtQQList" style="width:600px; float:left ; margin-left:0px"/>

</div>

<div style="width:750px; height:1%; text-align:20px; float:left; margin: 30px auto auto 30px ;">

<div style="width:700px; height:25px; text-align:left; float:left; margin:0px 0px; line-height:25px;">

<input type="button" value="查看结果" style="margin-left:30px" onclick="setQQList()"/>

</div>

<div style="width:700px; height:1%; text-align:left;float:left; margin:0px; line-height:25px;" id="divQQList">

<ul>

<li></li>

</ul>

</div>

<div class="clear"></div>

</div>

</div>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: