document.write('') function CreateAjax() { var XMLHttp; try { XMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { try { XMLHttp = new XMLHttpRequest(); } catch(e) { XMLHttp = false; } } return XMLHttp; } function Dig(id) { _xmlhttp = CreateAjax(); var url = "/save.asp?id="+id+"&n="+Math.random()+""; if(_xmlhttp) { var content = document.getElementById("dig"+id); var dig = document.getElementById(id); _xmlhttp.open('GET',url,true); _xmlhttp.onreadystatechange=function() { if(_xmlhttp.readyState == 4) { if(_xmlhttp.status == 200) { var ResponseText = unescape(_xmlhttp.responseText); var r=ResponseText.split(","); if(r[0] == "Dig" ) { alert("您已经投过票了 不能再投了!"); dig.innerHTML=r[1]; } else if(ResponseText == "NoData") { alert("参数错误!"); } else { dig.innerHTML=ResponseText; alert("投票成功"); content.innerHTML='成功'; } } else { alert("服务器返回错误!"); top.location.href='/index.asp'; } } else { dig.innerHTML=''; } } _xmlhttp.send(null); } else { alert("您的浏览器不支持或未启用 XMLHttp!"); } }