ajax php教程仿网易文章评论顶一下效果
js ajax
function setcookie(c_name,value,expiredays){ //设置cookie
var exdate=new date();
exdate.setdate(exdate.getdate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.togmtstring());
}function createxmlhttprequest(){ //创建xmlhttprequest对象
if(window.activexobject){ //ie
try {
return new activexobject("microsoft.xmlhttp");
} catch(e){
return;
}
}else if(window.xmlhttprequest){ //mozilla,firefox
try {
return new xmlhttprequest();
} catch(e){
return;
}
}
}function get_top_num(id){ //主调函数
var get_top_cookie=getcookie('get_top_'+id+'_cookie');
if(get_top_cookie!=null && get_top_cookie!=""){
alert('此条评论你已经支持过了');
}
else{
var xmlhttp=createxmlhttprequest();
var url = "action.php?action=top_num&id="+id;
if (id==""){
return false ;
}
if (xmlhttp){
callback = getreadystatehandler(xmlhttp,id);
xmlhttp.onreadystatechange = callback;
xmlhttp.open("get", url,true);
xmlhttp.send(null);
}
setcookie('get_top_'+id+'_cookie','istop',1);
}
}function getreadystatehandler(xmlhttp,id){ //服务器返回后处理函数
var top_num = document.getelementbyid("top_num_"+id).innerhtml;
return function (){
if(xmlhttp.readystate == 4){
if(xmlhttp.status == 200){
if (xmlhttp.responsetext==1){
document.getelementbyid("top_num_"+id).innerhtml=number(top_num)+1;
}
}
}
}
}//-->

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

记事本++7.3.1
好用且免费的代码编辑器

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境