大力推广普通话

文章来源: 作者: 发布时间:2018年09月19日 点击数: 字体:

[打印文章] [添加收藏]
更多
上一篇:推广普通话宣传图[ 09-19 ]
下一篇:没有了!
//初始化评论 function commentInit() { $.pe.ajax('accessLabel',{labelName:'内容评论标签',currentPage:1,params:{itemId:6647,nodeId:171},success:function(response){ $('#commentform').html($(response).find('body').text()); changepage(1, '评论列表', 'JS_基本风格'); setCurrentUserInfo(); }}) } //添加评论 function addComment() { if ($('#commentTitle').val == '') { alert("请输入标题!"); $('#commentTitle').focus(); return; } if ($('#commentIsAnonymous').val() == 'false') { if ($('#commentUsername').val() == '') { alert("请输入用户名!"); $('#commentUsername').focus(); return; } if ($('#commentEmail').val() == '') { alert('请输入Email地址!'); $('#commentEmail').focus(); return; } var regEmail = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; if ($('#commentEmail').val().match(regEmail) == null) { alert('请输入正确的Email格式!'); $('#commentEmail').focus(); return; } } if ($('#commentContnet').val == '') { alert("请输入评论内容!"); $('#commentContnet').focus(); return false; } var commentValidCode = ""; var checkValidCode = false; if (document.getElementById('commentValidCode') != null) { if ($('#commentValidCode').val() == '') { alert("请输入验证码!"); $('#commentValidCode').focus(); return; } commentValidCode = $('#commentValidCode').val(); checkValidCode = true; } $.pe.ajax('addcomment',{params:{ username:$("#commentUsername").val(), commenttitle:$("#commentTitle").val(), content:$("#commentContnet").val(), email:$("#commentEmail").val(), gid:6647, nid:171, private:$("#commentIsPrivate").val(), position:$("#commentViewpoint").val(), score:$("#commentRanking").val(), TxtValidCode:commentValidCode, isguest:$('#commentIsAnonymous').val() }, success:function(response){ var data = $(response); var status = data.find('status').text(); switch (status) { case "ok": changepage(1, '评论列表', 'JS_基本风格'); alert("发表评论成功!"); window.location.href = '#commentTarget'; $("#commentContnet").val(''); break; case "check": alert("发表评论成功,请等待管理员审核。"); break; case "err": alert("发表评论失败!"); break; case "nopurview": alert("此栏目已禁止发表评论!"); break; case "noTourists": alert("此栏目已禁止游客发表评论!"); break; case "checkCodeError": $("#commentValidCode").val(''); refreshValidCode($("#commentValidCodeImg")[0]); alert("您输入的验证码和系统产生的不一致,请重新输入!"); break; default: alert("发表评论失败!"); break; } if (checkValidCode) { refreshValidCode($("#commentValidCodeImg")[0]); $("#commentValidCode").val(''); checkValidCode = false; } }}) } function addPkZone(commentid, position, content) { $.pe.ajax('addpkzone',{params:{ commentid:commentid, position:position, content:content }, success:function(response){ switch ($(response).find('status').text()) { case "ok": changepage(1, '评论列表', 'JS_基本风格'); break; default: alert("辩论失败!"); break; } }} ) } //更新列表 function changepage(pagenum, sourcename, spanname) { $.pe.ajax('accessLabel',{labelName:sourcename,currentPage:pagenum,params:{ itemId:6647, page:'true', pagesize:5, currentpage:pagenum }, success:function(response){ $('#pe100_'+sourcename).html($(response).find('body').text()); $('#commentCount').html($(response).find("total").text()); updatepage(spanname, sourcename, response); }} ) } //更新分页 function updatepage(spanname, sourcename, xml) { $.pe.ajax('accessPage',{labelName:spanname,pageName:sourcename,recordCount:$(xml).find('total').text(),currentPage:$(xml).find('currentpage').text(),pageSize:$(xml).find('pagesize').text(),success:function(s){ if ($('#pe100_page_' + sourcename) != null) { $('#pe100_page_' + sourcename).html($(s).find('body').text()); } }}) } //设置默用户信息 function setCurrentUserInfo() { try { $.pe.ajax('checkUserLogin',{success:function(response){ if($(response).find('status').text() == 'ok'){ if ($('#commentUsername') != null) { $('#commentUsername').val($(response).find("username").text()); $('#commentEmail').val($(response).find("email").text()); $('#commentUsername').disabled = true; $('#commentEmail').disabled = true; } } }}) } catch (e) { } } //刷新验证码 function refreshValidCode(obj) { obj.src = obj.src + '?code=' + randomNumber(10); } function randomNumber(n) { var rnd = ''; for (var i = 0; i < n; i++) rnd += Math.floor(Math.random() * 10); return rnd; } //设置匿名 function setAnonymous(obj) { if (obj.checked) { $('#commentUsernameBlock').hide(); $('#commentEmailBlock').hide(); $('#commentIsAnonymous').val('true'); } else { $('#commentUsernameBlock').show(); $('#commentEmailBlock').show(); $('#commentIsAnonymous').val('false'); } } //设置私有 function setPrivate(obj) { if (obj.checked) { $('#commentIsPrivate').val(1); } else { $('#commentIsPrivate').val(0); } } //设置观点 function setViewpoint(value) { for (i = -1; i < 2; i++) { if (i == value) { $('#commentViewpointTab' + i)[0].className = "current"; } else { $('#commentViewpointTab' + i)[0].className = ""; } } $('#commentViewpoint').val(value); } //设置按钮 function changeBtnStyle(obj, className) { obj.className = className; } //设置评分 function changeRanking(index, isfixed) { var colStars = $("#commentRankingBlock input"); var k = isfixed ? parseInt($("#commentRanking").val()) : index; for (var i = 0; i < colStars.length; i++) { colStars[i].src = (i < k ? "/Images/fstar.gif" : "/Images/estar.gif"); } } function rankingClick(index) { $("#commentRanking").val(index); } function rankingMouseOver(index) { changeRanking(index, false); } function rankingMouseOut() { changeRanking(0, true); } //初始化评论 commentInit();

鄂公网安备 42062402000033号