原创作品,允许转载,转载时请务必以超链接形式标明文章
原始出处 、作者信息和本声明。否则将追究法律责任。
http://dgd2010.blog.51cto.com/1539422/714375
<script src="http://blog.51cto.com/contest2011/js/common.js?v=0.0.1" type="text/javascript"></script>
<li><a href="javascript:void(0);" class="vote" rel="1539422"><img src="http://blog.51cto.com/contest2011/images/gr_tp.jpg" width="98" height="34" /></a></li> </ul>
$(function() {
// 投票
$('.vote').click(function() {
var vuid = $(this).attr('rel');
var txt = '<table width="280" cellspacing="0" cellpadding="0" border="0" align="center">'
+ '<tr><td height="80" style="color:#da5e1c;"><img width="104" height="36" title="看不清?点击我" alt="看不清?点击我" src=\'#\'" /index.php?mod=seccode&_='+Math.random()+'" onclick=""http://blog.51cto.com/viewpic.php?refimg=" + this.src = \''+baseurl+'/index.php?mod=seccode&_=\' + Math.random();" style="cursor:pointer;" />(如果看不清请点击进行更换)</td></tr>'
+ '<tr><td>请输入验证码:<input type="text" class="tan_input" id="bseccode" name="bseccode" maxlength="4" /></td>'
+ '<input type="hidden" id="vuid" name="vuid" value="'+vuid+'" /></tr></table>';
$.prompt(txt,{
submit: votesubmit,
buttons: { 确定: 'yes', 取消: 'no' },
title: '输入验证码后给Ta投票'
});
});
// 留言
$(':input[name=wallsubmit]').click(function() {
var _this = this;
$(_this).attr('disabled', true);
var con = $(':input[name=content]');
var touid = $.trim($(':input[name=touid]').val());
if (touid == '') {
alert('请核对您填写了正确的参赛博主用户名');
$(':input[name=touser]').focus();
$(_this).attr('disabled', false);
return false;
}
if (con.val() == '') {
alert('输入内容');
con.focus();
$(_this).attr('disabled', false);
return false;
}
$.post(baseurl + '/index.php?mod=wall&do=add', {'touid':touid,'content':con.val()}, function(data) {
if (data.status == 1) {
var wall = data.data;
var _html;
if ($(':input[name=touser]').length > 0) {
_html = '<tr><td width="85"><b><a href="'+homeurl+'/index.php?s=/space/'+wall.uid+'" target="_blank">'+wall.username+'</a></b></td><td>刚刚</td></tr>'
+ '<tr><td colspan="2">我推荐<a href="'+baseurl+'/'+wall.touid+'">'+wall.touser+'</a>,' + con.val() + '</td></tr>';
$(':input[name=touser]').val('');
$(':input[name=touid]').val('');
} else {
_html = '<div class="grone" id="wall' + wall.id + '"><div class="grontit">'
+ '<h3><a href="'+homeurl+'/index.php?s=/space/'+wall.uid+'" target="_blank">'
+ wall.username + '</a><b>刚刚</b></h3></div>'
+ '<p>' + con.val() + '</p>'
+ '</div>';
}
$('#walllist').prepend(_html);
con.val('');
} else if (data.status == '-1') {
alert('请核对您填写了正确的参赛博主用户名');
} else if (data.status == '-2') {
alert('输入内容');
} else if (data.status == '-3') {
alert('自己不能给自己留言');
} else if (data.status == '-4') {
alert('该用户不是参赛用户');
} else {
alert('发表失败,请稍候再试');
}
$(_this).attr('disabled', false);
}, 'json');
});
});
function votesubmit(v,m,f){
if (v == 'yes') {
an = m.children('#seccode');
if(f.bseccode == ""){
alert('请输入验证码!');
return false;
}
$.post(baseurl + "/index.php?mod=vote", {bseccode:f.bseccode,vuid: f.vuid}, function(data){
if (data.status == 1) {
alert('投票成功');
// $('#vote'+f.vuid).html(data.data + ' 票');
$('.votenum'+f.vuid).html(data.data);
} else if (data.status == '-4') {
alert('验证码错误!');
return false;
} else if (data.status == '-5') {
alert('投票有异常哦,不符合投票规定吧?');
} else if (data.status == '0') {
alert('投票失败,请稍候再试!');
} else {
alert(data);
}
$.prompt.close();
}, 'json');
return false;
} else if (v == 'no') {
return true;
}
}
/*
function votepush(vuid) {
var txt = '<div class="poptit">投票结束!</div><br/>';
$.prompt(txt,{
buttons: { 确定: 'yes'}
});
}
*/
function closereg() {
var txt = '<div class="poptit">报名结束!</div><br/>';
$.prompt(txt,{
buttons: { 确定: 'yes'}
});
}
function wallload() {
var args = arguments;
var page = args[0] == undefined ? 1 : args[0];
$('#moreinfo').text('加载中……');
$.post(baseurl + '/index.php?mod=wall&do=list&_=' + Math.random(), {page:page,touid:args[1]}, function(data) {
$('#moreinfo').remove();
$('#walllist').append(data);
});
}
#END