一個基於web的QQ程式 1(xml+asp)
來源:互聯網
上載者:User
refresh.htm
=========
<HTML>
<HEAD>
<title>線上QQ</title>
<link rel="stylesheet" type="text/css" href="forum.css">
</HEAD>
<BODY onload=online() scroll=no topmargin="0" leftmargin="0" style="background-color: #8482C6; color:
#FFFFFF; border: 2 solid #FFFFFF; padding: 0">
<marquee><font color=black>如果關閉此視窗將失去線上QQ功能!</font></marquee>
<!--嘿嘿!!這裡引用了ZEE的轉碼,用於解決無法顯示漢字的,本來還有一段的不過在俺用的時候,發現加上那一段就不行了,所以去掉了,有興趣的朋友可以到精華區去找一下zee的文章 -->
<script language="vbscript">
Function bytes2BSTR(vIn)
strReturn=""
For i=1 To LenB(vIn)
ThisCharCode=AscB(MidB(vIn,i,1))
If ThisCharCode<&H80 Then
strReturn=strReturn&Chr(ThisCharCode)
Else
NextCharCode=AscB(MidB(vIn,i+1,1))
strReturn=strReturn&Chr(CLng(ThisCharCode)*&H100+CInt(NextCharCode))
i=i+1
End If
Next
bytes2BSTR=strReturn
End Function
</script>
<!--漢字轉換函式結束 -->
<script language="javascript">
var lengt=0;
<!--消除右鍵功能-->
function no(){
alert("不支援右鍵!");
self.event.returnValue=false;
}
<!--彈出QQ對話方塊,見後面-->
function sqq(uid,id){
window.open("sqq.asp?id="+id+"&uid="+uid,"_blank","width=400,height=180");
}
<!--關鍵的函數,用於顯示線上的會員-->
function online(){
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("post","online.asp",false);
xmlhttp.send();
var xmldom=new ActiveXObject("Microsoft.XMLDOM");
xmldom.async=false;
body=bytes2BSTR(xmlhttp.responseBody);
xmldom.loadXML(body);
if(xmldom.parseError.errorCode!=0){
window.open("refresh2.asp","_self");<!--為了防止有些使用者不支援xml,所以用了一個備用的asp版的-->
return
}
else{
var uid=xmldom.documentElement.selectNodes("uid");
var id=xmldom.documentElement.selectNodes("id");
var sex=xmldom.documentElement.selectNodes("sex");
var xx="";
lengt=uid.length;
for(var i=0;i<lengt;i++){
var im="";
if(id(0).text!="k") im="<img src=http://edu.cnzz.cn/jy/face/1.gif width=12 height=12>";
xx=xx+im+"<font color=red onclick=sqq('"+uid(i).text+"','"+id(i).text+"') style='cursor:hand'
title='"+sex(i).text+"'>"+uid(i).text+"</font><br>";
}
disonline.innerHTML=xx;
window.setTimeout("online()",3000);
}
}
</script>
<!--這個"resfresh4.asp"是用於當有自己的資訊時彈出QQ對話方塊用的-->
<iframe src="refresh4.asp" width=0 height=2 marginwidth=0 marginheight=0 frameborder=0>
</iframe>
<input type=button value=" 線上網友:" class=ddyinput2>
<div id=disonline style="height:230;overflow: auto"></div><br>
<!--這裡用到了scriptlet技術,你也可以試一下,和include差不多-->
<OBJECT data=i11.htm height=14 style="HEIGHT: 93px; WIDTH: 770px"
type=text/x-scriptlet width=14 VIEWASTEXT></OBJECT>
</BODY>
</HTML>
好了,第一部分就到這裡了!!