做了個用來通知論壇有新貼子的hta
把下面的代碼copy到本地另存為hta雙擊就可以執行了,出現新帖子會在右下角冒個窗口出來通知,10s後自動關閉通知窗口
代碼如下:
<html>
<head>
<title>BlueIdeaBoardWatcher-ByHutia</title>
<!--程序設置,如果希望程序在任務欄顯示,請將showintaskbar改為yes-->
<hta:applicationid="app1"singleinstance="yes"contextmenu="yes"
sysmenu="yes"windowstate="normal"maximizeButton="no"minimizeButton="yes"
applicationName="BlueIdeaBoardWatcher"version="1.0"innerBorder="no"
caption="yes"showintaskbar="no"border="thin"/>
<!--語種gb2312-->
<metahttp-equiv="content-type"content="text/html;charset="gb2312">
<!--樣式表-->
<style>
body,td{
margin:0px;
padding:5px;
overflow:auto;
font-size:12px;
}
h3{
font-size:14px;
}
iframe{
display:none;
}
</style>
<script>
//******全局變量區*****
//經典論壇>Dreamweaver&Javascript專欄
url="http://bbs.blueidea.com/forumdisplay.php?fid=1";
//刷新間隔10s
intervals=10000;
//初始化組件
try{
varxmlHttp=newActiveXObject("Microsoft.XMLHTTP");
varadodbStream=newActiveXObject("ADOD"+"B.St"+"ream");
}catch(e){
document.write("<h3>加載失敗,組件被禁止</h3>");
}
thisDomain=location.href.substring(0,location.href.lastIndexOf("//"));
//將上次訪問的結果保存在ree中用來與下次作對比
ree=newArray();
//用於判斷是否初始化完畢的變量
inited=false;
//保存打開的窗口的數組
theWin=newArray();
//初始化函數
functioninit(){
startCheck();
}
//發送get請求
functionstartCheck(){
xmlHttp.open("get",url,true);
xmlHttp.send();
xmlHttp.onreadystatechange=checkState;
}
//確認xmlHttp返回的結果
functioncheckState(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
//解碼獲得返回值
varstrHTML=b2s(xmlHttp.responseBody);
variStart=strHTML.search(/<tablecellspacing=0cellpadding=0width="99%"border=0>/i);