<div id="vote" data_id="文章唯一key"> <span id="dig" class="vote-btn"><span class="vote-num">顶的次数</span></span> <span id="bury" class="vote-btn"><span class="vote-num">踩的次数</span></span> </div>
#vote {
/* margin: 0 auto; */
text-align: center;
}
.vote-btn {
margin: 0 20px;
display: inline-block;
width: 60px;
height: 54px;
cursor: pointer;
}
#dig {
backgroundnull:url("http://www.1sucai.cn/static/image/dig.gif");
}
#bury {
backgroundnull:url("http://www.1sucai.cn/static/image/bury.gif");
}
.vote-num {
display: inline-block;
font-size: 14px;
margin-top: 32px;
color: white;
}
$("#vote .vote-btn").bind("click", function(){
var me = $(this);
var id = me.parent().attr("data_id");
var type = this.id;
$.post("请求地址", {'type': type, 'id': id }, function(data){
data = $.trim(data);
if(data == 'success'){ //如果投票成功
$num = me.find(".vote-num");
$num.html( parseInt($num.html()) + 1 ); //投票+1
//取消绑定的点击事件,并还原鼠标指针样式
$("#vote .vote-btn").unbind("click").css("cursor", "auto");
if(type == 'bury'){
alert("您投了反对票,敬请在评论中留言告知您的意见,以便于我们改正!");
}
}else if(data == 'done'){ //如果已经投票过
//取消绑定的点击事件,并还原鼠标指针样式
$("#vote .vote-btn").unbind("click").css("cursor", "auto");
alert("您已经投票过,无法再次投票!");
}else{ //投票失败
alert("由于系统或网络问题,投票没有成功,建议您稍后重新投票!");
}
});
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有