日期:2014-05-16 浏览次数:20481 次
<script language="javascript">
var timeUp = 0;
var NewsID = "<%=SeleceNewsID%>".split(",");
delayRun();
//循环执行任务,延时操作
function delayRun(code,time){
url='http://localhost/keywordsget1.asp?NewsID='+NewsID[timeUp];
validateEmail(url);
var WidthP = timeUp/NewsID.length;
WidthP = Math.round(WidthP * 100)+"%";
[color=#FF0000]alert(WidthP+":"+url);[/color] //这里用alert就可以正常运行,用document.write或者document.其他方法都不行,请问这是为什么呢
if(timeUp < NewsID.length){
timeUp++;
var t = setTimeout(function(){delayRun(code,time);},time);
}else{
clearTimeout(t);
}
}
//XMLHTTP提交数据并获取网页内容
var xmlHttp;
function validateEmail(url) {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("GET", url);
xmlHttp.onreadystatechange = callback;
xmlHttp.send(null);
}
function callback() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
}
}
}
</script>