이 프로그램의 방법은 XMLHTTP를 사용하여 해당 HTML Code of Tencent 웹 사이트를 읽어 QQ 아바타를 얻는 것입니다. 이 아이디어에 따르면, 우리는 일기 예보, 뉴스 등과 같은 다른 웹 사이트의 많은 정보를 기어 다닐 수 있습니다.
<scriptLanguage = "JavaScript">
<!-
functiongetfaceimg (qqcode)
{
varre = newRegexp ( "^[1-9] {1}/d+$", "g");
if (! qqcode! re.test (qqcode)) 리턴;
varurl = "http://search.tencent.com/cgi-bin/friend/oicq_find?oicq_no="+qqcode;
varhttp = newActivexObject ( "microsoft.xmlhttp");
http.open ( "get", url, false, "", "");
http.setrequestheader ( "content-type", "text/html; charset = gb2312");
http.send ();
if (http.status! = 200) 반환;
varwebstr = http.responsetext;
re = newRegexp ( ""(http://img.tencent.com/face/] "]+)" ","ig ");
if (Re.test (Webstr))
return "<ahref ="http://search.tencent.com/cgi-bin/friend/uffer_show_info?ln= "+qqcode+" "target = _blanktitle ="QQ : "+qqcode+" "> <imgsrc ="+regexp. "width = 16height = 16Height = 16Height.
http = null;
}
document.write ( "내 QQ 상태 :"+getfaceimg ( "44723461"));
//->
</스크립트>