一段测试用定时触发的用户脚本

window.setInterval(function() {
///////开始
var RunTime = '2012/11/18 09:59:57';
var d2=new Date();
var d1 = new Date(Date.parse(RunTime));
if(d1<d2)
{
//定时运行 Runing

window.setInterval(function() {
if (window.ActiveXObject)
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
else if(window.XMLHttpRequest)
xmlHttp = new XMLHttpRequest();

var url ="http://www.google.com/index.asp";

var tempString = "param1=xxx&param2=zzz";
var queryString = encodeURI(encodeURI(tempString));
//防止乱码
xmlHttp.open("POST",url);
xmlHttp.onreadystatechange = function() { return; };
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.send(queryString);
}, 30); ///定时循环 毫秒

}
else
{
//Waiting
var ShowDiv = document.getElementById("halftime2");
ShowDiv.innerHTML = "Waitng:"+ Math.round((d1.getTime() - (new Date()).getTime() )/1000);
}
/////////结束
}, 1); ///定时循环 毫秒