110互动论坛's Archiver

免费法律咨询

yonglin 发表于 2010-3-27 13:56

【技巧】精彩:用Asp实现QQ在线查询

  <script language="JavaScript">
  <!--
  function getFaceImg(QQcode)
  {
  var Re=new RegExp("^[1-9]{1}\\d+$","g");
  if (!QQcode||!Re.test(QQcode)) return;
  var URL="//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("\"(//img.tencent.com/face/[^\"]+)\"","ig");
  if (Re.test(webStr))
  return "<a href=\"//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>

好诗岚 发表于 2010-3-27 13:57

不懂这个

yonglin 发表于 2010-3-27 13:58

慢慢学嘛

神仙姐姐 发表于 2010-3-27 13:58

不是很懂

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.