设为首页
加入收藏
站内地图
旧版入口
当前位置:首页 > 站长学院 > 网络编程 > ASP

实用篇:用asp实现QQ在线查询

作者:佚名 出处:网易学院 时间:08-22 点击:

内容载入中...

  用下面的代码即可实现与QQ网站一样的QQ网友在线查询的方式。

  <script language="JavaScript">

    <!--

     function getFaceImg(QQcode)

     {
   var Re=new RegExp("^[1-9]{1}\\d+$","g");

     if (!QQcode  !Re.test(QQcode)) return;

     var URL="http://search.tencent.com/cgi-bin/friend/oicq_find?oicq_no="+QQcode;

     var http=new ActiveXObject("Microsoft.XMLHTTP");

     http.open("GET",URL,false,"","");

     http.setRequestHeader("CONTENT-TYPE","text/html; Charset=gb2312");

     http.send();

     if (http.status!=200) return;  

   var webStr=http.responseText;

   Re=new RegExp("\"(http://img.tencent.com/face/[^\"]+)\"","ig");

   if (Re.test(webStr))

   return "<a href=\"http://search.tencent.com/cgi-bin/friend/user_show_info?ln="+QQcode+"\" target=_blank title=\"QQ:"+QQcode+"\"><img src=\""+RegExp.$1+"\" width=16 height=16 border=0></a>";  

   http=null;

   } 

   document.write("我的QQ状态:"+getFaceImg("44723461"));

  //-->

  </script> 

收藏本文:
】【打印页面】【推荐给朋友】【关闭窗口

站长学院

推荐信息