52,782
社区成员
发帖
与我相关
我的任务
分享
<!--#include file="cn.asp"-->
<%
sql = "select top 1 * from pk where id=1"
rs.open sql,cn,1,1
if rs.eof then
else
z_c =rs("zheng")
z_f =rs("fan")
end if
rs.close
%>
<!DOCTYPE html>
<html>
<head>
<title>PK擂台</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<link type="text/css" rel="stylesheet" href="reset.css" />
<link type="text/css" rel="stylesheet" href="style.css" />
<script type="text/javascript" src="jquery-1.4.js"></script>
<script type="text/javascript" src="js.js"></script>
</head>
<body>
<div class="box">
<h1>IT江湖PK擂台</h1>
<div class="con">
<h3>您是否看好国内婚恋网站上市前景?</h3>
<div class="zheng con_title" num="<%=z_c%>">
<div class="tip tip_z">+1</div>
<strong><span>正</span>非常看好</strong>
<p>婚恋网站有着很强的针对性和用户黏性,极具商业价值。</p>
<div class="bbox">
<div class="bboxc"></div>
</div>
<div class="survey">
<span>加载.</span>
<input type="button" class="input_btn" value="投票" id="btn_zheng" />
</div>
</div>
<div class="fan con_title" num="<%=z_f%>">
<div class="tip tip_f">+1</div>
<strong><span class="green">反</span>不看好</strong>
<p>婚恋网站只能满足用户短期需求,很难产生长尾效应。</p>
<div class="bbox green">
<div class="bboxc green"></div>
</div>
<div class="survey">
<span>加载.</span>
<input type="button" class="input_btn" value="投票" id="btn_fan" />
</div>
</div>
</div>
</div>
</body>
</html>
$(document).ready(function(){
//alert(1)
//加载DOM完毕后,显示最新票数,并统计该项目正反总票数
function show(){
var tot = 0;
$('.survey span').each(function(){
$(this).text( $(this).parents('.con_title').attr('num') );
tot+=+$(this).parents('.con_title').attr('num');
});
//滚动box进度
$('.zheng .bboxc').animate({
'width': +$('.zheng .survey span').text()/tot * 100 +'px'
},1000);
$('.fan .bboxc').animate({
'width': +$('.fan .survey span').text()/tot * 100 +'px'
},1000);
}
show();
function show1(){
var tot = 0;
$('.survey span').each(function(){
tot += +$(this).text();
});
//滚动box进度
$('.zheng .bboxc').animate({
'width': +$('.zheng .survey span').text()/tot * 100 +'px'
},1000);
$('.fan .bboxc').animate({
'width': +$('.fan .survey span').text()/tot * 100 +'px'
},1000);
}
//点击正方按钮
$('#btn_zheng').click(function(){
$.ajax({
type: "get",
url: "pk.asp",
data: {zf:'z'},
dataType: 'json',
beforeSend:function(){
$('.zheng .survey span').text('loading');
},
error: function(xhr) {
alert('Ajax出错');
},
success:function(data){
$('.tip_z').show().animate({
'top':'20',
'opacity':'0'
},1000,function(){
$(this).css({
'top':80,
'display':'none',
'opacity':1
})
})
$('.zheng .survey span').text(data.z);
$('.fan .survey span').text(data.f);
show1();
}
});
});
$('#btn_fan').click(function(){
$.ajax({
type: "get",
url: "pk.asp",
data: {zf:'f'},
dataType: 'json',
beforeSend:function(){
$('.fan .survey span').text('loading');
},
error: function(xhr) {
alert('Ajax出错');
},
success:function(data){
$('.tip_f').show().animate({
'top':'20',
'opacity':'0'
},1000,function(){
$(this).css({
'top':80,
'display':'none',
'opacity':1
})
})
$('.zheng .survey span').text(data.z);
$('.fan .survey span').text(data.f);
show1();
}
});
});
})
<!--#include file="cn.asp"-->
<%
zf = request("zf")
sql = "select top 1 * from pk where id=1"
rs.open sql,cn,1,3
if zf="z" then
rs("zheng") = rs("zheng")+1
else
rs("fan") = rs("fan")+1
end if
rs.update
z = rs("zheng")
f = rs("fan")
rs.close
response.write("{""z"":"&z&",""f"":"&f&"}")
%>