

//将用户输入异步提交到服务器
function ajaxSubmit(type,id){
	alert(type);
	//获取用户输入
	//var title=document.forms[0].title.value;
     var Type=type;
	//创建XMLHttpRequest对象
	//var xmlhttp=createXMLHttp();
// 创建一个布尔型变量
var xmlhttp = false;
// 检查使用的是否为IE浏览器
try{
　　// 如果JS的版本大于5
　　xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
　　// 如果不是，则使用老版本的ActiveX对象
　　try{
　　　　// 如果使用的是IE浏览器
　　　　 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
　　}catch(e){
　　　　// 使用非IE浏览器
　　　　 xmlhttp = false;
　　}
}
// 如果使用的是IE非浏览器
if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
　　xmlhttp = new XMLHttpRequest();
}
	//创建请求结果处理程序
	xmlhttp.onreadystatechange=function(){
		if (4==xmlhttp.readyState){
			if (200==xmlhttp.status){
				var requestinfo=xmlhttp.responseText;
				addToList(requestinfo);
			}else{
				alert("error");
			}
	}
	}
		
	//打开连接，true表示异步提交
	xmlhttp.open("post", "tp_act.asp", false);
	//当方法为post时需要如下设置http头
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	//发送数据
	xmlhttp.send("Type="+escape(Type)+"&id="+escape(id));
}

//将用户输入显示到页面
function addToList(date){
	 switch(date)
    {
        case "erroinfo":
            str = "对不起，您已经投过票！";
            break;
		case "goneview":
            str = "投票成功！";
			document.getElementById("goneview").innerHTML=parseInt(document.getElementById("goneview").innerHTML)+1
            break;
		case "thinkview":
            str = "投票成功！";
			document.getElementById("thinkview").innerHTML=parseInt(document.getElementById("thinkview").innerHTML)+1
            break;
		}

	alert(str);

}


//将用户输入异步提交到服务器
function ajaxSubmit1(type,id){
	//获取用户输入
	//var title=document.forms[0].title.value;
     var Type=type;
	 //alert(Type);
	//alert(nr);
	//创建XMLHttpRequest对象
	var xmlhttp=createXMLHttp();
	
	//创建请求结果处理程序
	xmlhttp.onreadystatechange=function(){
		if (4==xmlhttp.readyState){
			if (200==xmlhttp.status){
				var requestinfo=xmlhttp.responseText;
				//alert(requestinfo);
				addToList1(requestinfo);
				
			}else{
				alert("error");
			}
	}
	}
	//打开连接，true表示异步提交
	xmlhttp.open("post", "tp_act.asp", true);
	//当方法为post时需要如下设置http头
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	//发送数据
	xmlhttp.send("Type="+escape(Type)+"&id="+escape(id));
	
}

//将用户输入显示到页面
function addToList1(date){
	info=date.split('_');
	//alert(info[1]);
	 switch(info[0])
    {
        case "erroinfo":
            str = "对不起，您已经投过票！";
            break;
		case "goneview":
            str = "投票成功！";
			document.getElementById("goneview"+info[1]).innerHTML=parseInt(document.getElementById("goneview"+info[1]).innerHTML)+1
            break;
		case "thinkview":
            str = "投票成功！";
			document.getElementById("thinkview"+info[1]).innerHTML=parseInt(document.getElementById("thinkview"+info[1]).innerHTML)+1
            break;
		}

	alert(str);

}

//将用户输入异步提交到服务器
function sj(type,id,hitsort){
	//获取用户输入
	//var title=document.forms[0].title.value;
	 var id=id;
     var Type=type
	 var hitsort=hitsort;
	//alert(nr);
	//创建XMLHttpRequest对象
	var xmlhttp=createXMLHttp();
	
	//创建请求结果处理程序
	xmlhttp.onreadystatechange=function(){
		if (4==xmlhttp.readyState){
			if (200==xmlhttp.status){
				var requestinfo=xmlhttp.responseText;
				PicInfo(requestinfo);
				
			}else{
				alert("error");
			}
	}
	}
	//打开连接，true表示异步提交
	xmlhttp.open("post", "tp_pic.asp", true);
	//当方法为post时需要如下设置http头
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	//发送数据
	xmlhttp.send("Type="+escape(Type)+"&id="+escape(id)+"&hitsort="+escape(hitsort));
	
}
function PicInfo(info)
{
	info=info.split("_");
	if (info[2]="1")
	{
	document.getElementById(info[1]+info[0]).innerHTML=parseInt(document.getElementById(info[1]+info[0]).innerHTML)+1;
	}
}
			