当前位置: 首页 > 图文教程 > 网络编程 > ASP > 实用篇:用asp实现QQ在线查询

ASP
asp查询xml的代码 不刷新页面查询的方法
ASP 快速执行动态网页
asp实现本周的一周时间列表的代码
asp get和post数据接收过滤
为google量身定做的sitemap生成代码asp版
适合所有网站的rss和xml聚合功能asp代码
ASP MSSQL存储过程的实现小例
动网论坛的asp 数据库连接代码
ASP+MSSQL2000 数据库被批量注入后的解决方法
asp 去掉html中的table正则代码函数
asp 过滤非法字符函数
asp检测是否为中文字符函数
ASP 包含文件中的路径问题和使用单一数据库连接文件的解决方案
asp HTTP 500错误 常见问题分析
asp 关键词高亮显示(不区分大小写)
一段ASP的HTTP_REFERER判断代码
asp datediff 时间相减
asp下去除超链接的函数
asp连接mssql2005的代码
asp access数据库并生成XML文件范例

ASP 中的 实用篇:用asp实现QQ在线查询


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 253 ::
收藏到网摘: n/a

  用下面的代码即可实现与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>