<script type="text/javascript">
var pkid={$GetPKID};
var isLogin=false;
function CheckLogin()
{
if (isLogin==true) return;
$.ajax({
url: "ajax.asp",
cache: false,
data: "action=checklogin&id=" + pkid,
success: function(r){
r=unescape(r);
var arrobj=r.split('|');
if (arrobj[0]!="success")
{
if (arrobj[0]=="login")
{
ShowLogin();
}else{
Alert(arrobj[0],arrobj[1],arrobj[2]);
}
}else{
isLogin=true;
}
}
});
}
function submitCheck(role){
var content=''
if (role==1)
{
if (jQuery("#agreeContent").val()==''||jQuery("#agreeContent").val()=='请在这里发表自己的观点!')
{
KesionJS.Alert("请发表讨论内容!",'jQuery("#agreeContent").focus();');
return;
}
content=jQuery("#agreeContent").val();
}else if(role==2){
if (jQuery("#argueContent").val()==''||jQuery("#argueContent").val()=='请在这里发表自己的观点!')
{
KesionJS.Alert("请发表讨论内容!",'jQuery("#argueContent").focus()');
return;
}
content=jQuery("#argueContent").val();
}else{
if (jQuery("#otherContent").val()==''||jQuery("#otherContent").val()=='我要发表其它观点...')
{
KesionJS.Alert("请输入其它观点!",'jQuery("#otherContent").focus()');
return;
}
content=jQuery("#otherContent").val();
}
$.post("ajax.asp",{action:'savepost',id:pkid,content:escape(content),role:role}, function(r){
r=unescape(r);
var arrobj=r.split('|');
if (arrobj[0]!="success")
{
if (arrobj[0]=="login")
{
ShowLogin();
}else{
Alert(arrobj[0],arrobj[1],arrobj[2]);
}
}else{
KesionJS.Alert("提交成功!","");
setpkimg();
setpkgdlist();
jQuery("#agreeContent").val('请在这里发表自己的观点!');
jQuery("#argueContent").val('请在这里发表自己的观点!');
jQuery("#otherContent").val('我要发表其它观点...');
}
}
);
}
function setpkimg() {
var agreeNum = 0;
var argueNum = 0;
$.ajax({
url: "ajax.asp",
cache: false,
data: "action=getvotes&id=" + pkid,
success: function(r){
r=unescape(r)
var arr=r.split('|');
agreeNum=parseInt(arr[0]);
argueNum=parseInt(arr[1]);
$("#agreenum").html(""+agreeNum+"");
$("#arguenum").html(""+argueNum+"");
var total = agreeNum + argueNum;
var h3Width = 70;
var imgAgreeSpan = imgArgueSpan = 300;
var imgAgree = imgArgue = imgAgreeSpan + h3Width;
if (total != 0) {
var totalSpan = imgAgreeSpan * 2;
imgAgreeSpan = Math.round(agreeNum / total * totalSpan);
imgAgree = imgAgreeSpan + h3Width;
imgArgueSpan = totalSpan - imgAgreeSpan;
imgArgue = imgArgueSpan + h3Width;
}
$("#pk_yes").css("width", imgAgree);
$("#pk_no").css("width", imgArgue);
$("#img_agree").css("width", imgAgreeSpan);
$("#img_argue").css("width", imgArgueSpan);
}
});
}
function setpkgdlist()
{
$.getScript("ajax.asp?action=getgdlist&role=1&id="+pkid);
$.getScript("ajax.asp?action=getgdlist&role=2&id="+pkid);
$.getScript("ajax.asp?action=getgdlist&role=3&id="+pkid);
}
function showagree(commentJsonVarStr___){
data=formattime(commentJsonVarStr___);
if (data.comments != null) {
//绑定模板
var node = $($(".agreetpl").html()).bindTo(data);
//显示
$("#agreecomm").html(node);
}
}
function showargue(commentJsonVarStr___){
data=formattime(commentJsonVarStr___);
if (data.comments != null) {
//绑定模板
var node = $($(".arguetpl").html()).bindTo(data);
//显示
$("#arguecomm").html(node);
}
}
function showother(commentJsonVarStr___){
data=formattime(commentJsonVarStr___);
if (data.comments != null) {
//绑定模板
var node = $($(".othertpl").html()).bindTo(data);
//显示
$("#othercomm").html(node);
}
}
//格式化时间
function formattime(data){
var str = null;
if (data.comments != null) {
for(i=0; i<data.comments.length;i++) {
str = /^(\d+)\-(\d+)\-(\d+)(?:\s+(\d+):(\d+)(?::(\d+))?)?$/.exec(data.comments['comment_date']);
data.comments[i]['comment_date'] = str[1]+'/'+str[2]+'/'+str[3]+' '+str[4]+':'+str[5];
}
}
return data;
}
$(document).ready(function(){
setpkimg();
setpkgdlist();
});
</script>
<div class="pkalist" style="margin-top:60px;">
<!--支持模板-->
<div class="agreetpl" style="display:none">
<!--data--><!--comments-->
<div class="acontents">
<p>{comment_contents}</p>
</div>
<!--comments--><!--data-->
</div>
<!--支持模板结束--><!--显示支持-->
<div id="agreecomm"> </div>
</div>
请教下,PK系统原来是正反两边分别显示内容的,我去掉了反边的内容,怎么让正反的内容都在正方的内容区里显示出来呢;
[/i]