Метод этой программы состоит в том, чтобы использовать XMLHTTP для чтения соответствующего HTML -кода веб -сайта Tencent для получения QQ Avatar. Согласно этой идее, мы также можем ползти много информации с других веб -сайтов, таких как прогнозы погоды, новости и т. Д.
<scriptlanguage = "javascript">
<!-
functionGetFaceImg (QQCode)
{
varre = newRegexp ("^[1-9] {1}/d+$", "g");
if (! qqcode! re.test (qqcode)) return;
varurl = "http://search.tencent.com/cgi-bin/friend/oicq_find?oicq_no="+qqcode;
varhttp = newAcatexObject ("microsoft.xmlhttp");
http.open ("Get", url, false "", "");
http.setrequestheader ("content-type", "text/html; charset = gb2312");
http.send ();
if (http.status! = 200) return;
varwebstr = http.responsetext;
Re = newRegexp ("" (http://img.tencent.com/face/tr^ "]+)" "," ig ");
if (re.test (webstr))
вернуть "<ahref =" http://search.tencent.com/cgi-bin/friend/user_show_info?ln= "+qqcode+" "target = _blanktitle =" qq: "+qqcode+" "> <imgsrc =" "+regexp. $ 1+" "width = 16He = 16He = 16He = 16He = 16He = 16HE = 16.
http = null;
}
document.write ("My QQ Status:"+getFaceimg ("44723461"));
//->
</script>