HTA code to inform the Forum of new posts _hta

Source: Internet
Author: User
I made an HTA to inform the Forum of new posts.

The following code copy to the local save as an HTA double-click can be executed, a new post will be in the lower right corner of the window come out notice, 10s automatically close the notification window
Copy Code code as follows:

<title>blue idea Board watcher-by hutia</title>
<!--program settings, if you want the program to appear in the taskbar, change ShowInTaskbar to Yes-->
sysmenu= "yes" windowstate= "normal" maximizebutton= "no" minimizebutton= "yes"
Applicationname= "Blueideaboardwatcher" version= "1.0" innerborder= "no"
caption= "yes" showintaskbar= "no" border= "thin"/>
<!--language gb2312-->
<meta http-equiv= "Content-type" content= "text/html; charset= "gb2312" >
<!--style sheet-->
<style>
Body, TD {
margin:0px;
padding:5px;
Overflow:auto;
font-size:12px;
}

h3 {
font-size:14px;
}

iframe {
Display:none;
}
</style>
<script>
Global variable Area * * *
Classic Forums > Dreamweaver & JavaScript columns
Url= "Http://bbs.blueidea.com/forumdisplay.php?fid=1";

Refresh Interval 10s
intervals=10000;

Initializing components
try{
var xmlhttp=new activexobject ("Microsoft.XMLHTTP");
var adodbstream=new activexobject ("Adod" + "B.st" + "ream");
}catch (e) {
document.write ("}

Thisdomain=location.href.substring (0,location.href.lastindexof ("\/"));
Keep the results of the last visit in Ree for comparison with the next
Ree=new Array ();
Variable to determine whether the initialization is complete
Inited=false;
To save an array of open windows
Thewin=new Array ();

initialization function
function init () {
Startcheck ();
}

Send a GET request
function Startcheck () {
Xmlhttp.open ("Get", url,true);
Xmlhttp.send ();
Xmlhttp.onreadystatechange=checkstate;
}

Confirm results returned by XMLHTTP
function CheckState () {
if (xmlhttp.readystate==4) {
if (xmlhttp.status==200) {
Decoding gets the return value
var strhtml=b2s (xmlhttp.responsebody);
var istart=strhtml.search (/<table cellspacing=0 cellpadding=0 width= "99%" border=0>/i);
var iend=strhtml.indexof ("\r\n<\/table>\r\n", IStart);
Strhtml=strhtml.substring (Istart,iend);
try{
F1.document.open ();
F1.document.clear ();
F1.document.write (strhtml);
F1.document.close ();
}catch (e) {}
Change the link in the return value to an absolute address
for (Var i=0;i<f1.document.links.length;i++) {
F1.document.links[i].href=f1.document.links[i].href.replace (Thisdomain, "Http://www.blueidea.com/bbs");
}
var result=new Array ();
try{
var thetable=f1.document.all.tags ("TABLE") [1];
for (Var i=1;i<thetable.rows.length;i++) {
Stru=thetable.rows[i].cells[3].firstchild.href;
strt=thetable.rows[i].cells[3].firstchild.innerhtml;
Strc=thetable.rows[i].cells[6].innertext;
if (inited) {
if (REE[STRU]!=STRC) {
REE[STRU]=STRC;
RESULT[STRU]=STRT;
}
}else{
REE[STRU]=STRC;
}
}
Inited=true;
for (var i on result) {
Popupwin (I,result[i]);
}
}catch (e) {}
}
SetTimeout (startcheck,intervals);
return (false);
}
}

Pop-up window
function Popupwin (strurl,strtext) {
var mx=screen.availwidth;
var my=screen.availheight;
var w=200;
var h=150;

Therow=d1.insertrow (0);
Thecell=therow.insertcell ();
Thecell.innerhtml= "<li><a target=\" _blank\ "href=\" "+strurl+" \ ">" +strtext+ "</a>";

Strhtml= "strhtml+= "<style>body{margin:0px;padding:6px;background-color: #D0FFD0; overflow:auto;} \ r \ n ";
strhtml+= "div{width:100%;height:100%;overflow:hidden;text-overflow:ellipsis;";
strhtml+= "Text-indent:12px;border: #999 1px solid;cursor:hand;color: #005500;} </style> ";
strhtml+= "<body onload=\" settimeout (' Window.close (); ', 10000); \ ">";
strhtml+= "<div onclick=\" window.open (' +strurl+ '); Window.close (); ">";
Strhtml+=strtext;
strhtml+= "</div></body>for (Var i=0;i<thewin.length;i++) {
if (thewin[i].closed) {
var n=parseint (my/120);
var l=parseint (i/n) +1;
var strmodal= "dialogwidth=" +w+ "px;dialogheight=" +h+ "px;dialogleft=" + (mx-w*l) + "px;dialogtop=" + (my-h* (i%n+1));
Thewin[i]=showmodelessdialog ("About:blank", Strtext,strmodal);
Thewin[i].document.open ();
Thewin[i].document.clear ();
Thewin[i].document.write (strhtml);
Thewin[i].document.close ();
Thewin[i].focus ();
return (false);
}
}
var n=parseint (my/120);
var l=parseint (i/n) +1;
var strmodal= "dialogwidth=" +w+ "px;dialogheight=" +h+ "px;dialogleft=" + (mx-w*l) + "px;dialogtop=" + (my-h* (i%n+1));
Thewin[i]=showmodelessdialog ("About:blank", Strtext,strmodal);
Thewin[i].document.open ();
Thewin[i].document.clear ();
Thewin[i].document.write (strhtml);
Thewin[i].document.close ();
Thewin[i].focus ();
return (false);
}

function B2s (b) {
Adodbstream.type=1;//1=adtypebinary
Adodbstream.open ();
Adodbstream.write (b);
adodbstream.position=0;
adodbstream.type=2;
Adodbstream.charset= "gb2312";
Adodbstream.charset= "_autodetect_all";
var re=adodbstream.readtext ();
Adodbstream.close ();
return (re);
}

Window.attachevent ("onload", init);

</script>

<body>
<table id=d1></table>
<iframe id= "F1" ></iframe>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.