做了个用来通知论坛有新贴子的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);