用來通知論壇有新貼子的hta代碼
2024-08-26 00:15:48
供稿:網友
做了個用來通知論壇有新貼子的hta
把下面的代碼copy到本地另存為hta雙擊就可以執行了,出現新帖子會在右下角冒個窗口出來通知,10s后自動關閉通知窗口
代碼如下:
<html>
<head>
<title>Blue Idea Board Watcher - By Hutia</title>
<!-- 程序設置,如果希望程序在任務欄顯示,請將showintaskbar改為yes -->
<hta:application id="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 -->
<meta http-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{
var xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
var adodbStream=new ActiveXObject("ADOD"+"B.St"+"ream");
}catch(e){
document.write("<h3>加載失敗,組件被禁止</h3>");
}
thisDomain=location.href.substring(0,location.href.lastIndexOf("http://"));
//將上次訪問的結果保存在ree中用來與下次作對比
ree=new Array();
//用于判斷是否初始化完畢的變量
inited=false;
//保存打開的窗口的數組
theWin=new Array();
//初始化函數
function init(){
startCheck();
}
//發送get請求
function startCheck(){
xmlHttp.open("get",url,true);
xmlHttp.send();
xmlHttp.onreadystatechange=checkState;
}
//確認xmlHttp返回的結果
function checkState(){
if (xmlHttp.readyState==4){
if (xmlHttp.status==200){
//解碼獲得返回值
var strHTML=b2s(xmlHttp.responseBody);
var iStart=strHTML.search(/<table cellspacing=0 cellpadding=0 width="99%" border=0>/i);