用js實(shí)現(xiàn)QQ在線查詢功能
更新時間:2007年06月14日 00:00:00 作者:
這段程序的方法是利用XMLHTTP來讀取騰訊網(wǎng)站的相應(yīng)HTML代碼獲取QQ的頭像,根據(jù)這個想法,我們還可以抓取很多其他網(wǎng)站的信息,如天氣預(yù)報、新聞等等。
<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 ;
http=null;
}
document.write("我的QQ狀態(tài):"+getFaceImg("44723461"));
//-->
</script>
<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 ;
http=null;
}
document.write("我的QQ狀態(tài):"+getFaceImg("44723461"));
//-->
</script>
相關(guān)文章
Highlight patterns within strings
Highlight patterns within strings...2007-04-04
aspupload文件重命名及上傳進(jìn)度條的解決方法附代碼
aspupload文件重命名及上傳進(jìn)度條的解決方法附代碼...2007-08-08
asp實(shí)現(xiàn)獲取MSSQL數(shù)據(jù)庫表指定條件行數(shù)的函數(shù)
這篇文章主要介紹了asp實(shí)現(xiàn)獲取MSSQL數(shù)據(jù)庫表指定條件行數(shù)的函數(shù)的的相關(guān)資料,需要的朋友可以參考下2015-03-03
ASP中實(shí)現(xiàn)的URLEncode、URLDecode自定義函數(shù)
這篇文章主要介紹了ASP中實(shí)現(xiàn)的URLEncode、URLDecode自定義函數(shù),和ASP自帶的server.urlencode是不一樣的哦,需要的朋友可以參考下2014-07-07
ASP關(guān)于編碼的幾個有用的函數(shù)小結(jié)(utf8)
UTF8轉(zhuǎn)GB2312將UTF8編碼文字轉(zhuǎn)換為GB編碼文字,UTF8編碼文字將轉(zhuǎn)換為漢字的代碼,需要的朋友可以參考下。2011-05-05
使用ASP在IIS創(chuàng)建WEB站點(diǎn)的函數(shù)
使用ASP在IIS創(chuàng)建WEB站點(diǎn)的函數(shù)...2007-01-01

