标题: [求助]无刷新鲜花鸡蛋投票 [打印本页] 作者: 孤独の浪子 时间: 2010-1-10 06:32 标题: [求助]无刷新鲜花鸡蛋投票 无刷新鲜花鸡蛋投票代码,不知何故不成功,以下是代码:
ajax.js代码
function v(){
return;
}
//Ajax Start
function Ajax_GetXMLHttpRequest() {
if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
return new XMLHttpRequest();
}
}
function Ajax_CallBack(ID,URL){
var x = Ajax_GetXMLHttpRequest();
var ID = document.getElementById(ID);
x.onreadystatechange = function(){
if(x.readyState == 4){
if(x.status == 200){
if(x.responseText!=""){
ID.innerHTML=x.responseText;
}else{
alert('您已投过票,不可以重复投票!');}}}}
x.open('GET',URL,true);
x.send(null);
}
//Ajax End
页面代码:
<!--#include File="conn.asp"-->
<script language="javascript" src="ajax.js"></script>
<%set rs=server.CreateObject("adodb.recordset")
sql="select * from news"
rs.open sql,conn,1,1%>
<%n=0
do while not rs.eof%>
<%
rs.movenext
n=n+1
if n=10 then exit do
loop
rs.close
%>
FlowerEgg.asp文件代码:
<!--#include file="conn.asp"-->
<%
postID=Request("PostID")
s=Request("status")
if IsNumeric(postID)=true then
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from [news] where ID="&PostID
rs.Open sql,conn,3,2
if instr("|"&Rs("BallotIPList"),"|"&Request.ServerVariables("REMOTE_ADDR")&"|")>0 then
Response.write("")
rs.close
else
if s="support" then
flower=rs("flower")+1
rs("flower")=flower
rs("BallotIPList")=rs("BallotIPList")&Request.ServerVariables("REMOTE_ADDR")&"|"
rs.Update
rs.close
response.write(flower)
response.write""&rs("BallotIPList")&""
elseif s="oppose" then
egg=rs("egg")+1
rs("egg")=egg
rs("BallotIPList")=rs("BallotIPList")&Request.ServerVariables("REMOTE_ADDR")&"|"
rs.Update
rs.close
response.write(egg)
end if
end if
end if
%>作者: 星溯~~~~天空 时间: 2010-1-10 06:32
你这样投票方式肯定不行,问题出在FlowerEgg.asp文件里