网页投票程序脚本

<script>
function vote(n) {
var date = new Date("May 13,2009 12:00") – new Date();
if(date>0){
   alert("投票系统在2009/5/19 12:00:00开启")
   return;
}
var d = "<div style=’text-align:center’>"
d += "<div id=’checkimg’ style=’background:url(inc/checkCode.asp) no-repeat;cursor:pointer;width:40px;height:10px;’/ onclick=\"this.style.backgroundImage=’url(inc/checkCode.asp)’\"> </div>";
d += "<br />";
d += "请输入验证码:<input name=’checkcode’ id=’checkcode’ /><input type=’button’ value=’提交’ onclick=’sendVote(" + n + ")’/>";
d += "</div>"
var s = new fullScreenWindow(200,100,d);
}
function sendVote(n) {
var xhr = new Ajax();
xhr.open("POST","vote.asp",true);
//xhr.setRequestHeader(‘Referer:’, ‘http://whzx5byb.blogcn.com/’);
xhr.setRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);
xhr.setRequestHeader(‘Hostname’,'http://221.212.47.1/’);
var c = document.getElementById("checkcode").value;
var query = "id=" + n + "&checkCode=" + c;
xhr.send(query);

xhr.onreadystatechange = function(){
   if (xhr.readyState == 4)
   {

    if (xhr.status == 200)
    {

     alert(xhr.responseText);
     window.location.href = self.location;
    }
   }
};
}
</script>