例子,js判断qq客服是否在线。
复制代码 代码示例:
<div class="mid">
<p><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=1543097797&site=bannei.com&menu=yes" id="qq_service1"></a></p>
<p><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=1055881987&site=bannei.com&menu=yes" id="qq_service2"></a></p>
</div>
<script>
var online= new Array();
</script>
<script src="</script'>http://webpresence.qq.com/getonline?Type=1&1543097797:1055881987:"></script>
<script>
function SetOnline(id, service, online) {
var html = '<span><b>客服'+service+'</b>[点击留言]<span>';
if(online=='1') {
html = '<span style="color:red;"><b>客服'+service+'</b>[点击交谈]<span>';
}
$("#"+id).html(html);
}
SetOnline('qq_service1', '1', online[0]);
SetOnline('qq_service2', '2', online[1]);
</script>