// jscript 文件 //dig参数 function gettopnum(url, newsid, num, divid) { var action = url + '?no-cache=' + math.random() + '&newsid=' + newsid + '&getnum=' + num + ''; $.post(action, function (data) { var returnvalue = data; if (returnvalue.indexof("??") > -1) { returnvalue = ''; } $("#" + divid).html(returnvalue); }); } //公共ajax取数据 function pubajax(url, actionstr, divid) { var action = url + '?no-cache=' + math.random() + "&" + actionstr; $.post(action, function (data) { var returnvalue = data; if (returnvalue.indexof("??") > -1) { returnvalue = ''; } $("#" + divid).html(returnvalue); }); } //显示展示类型广告 function showads(adsid) { $.post("/jsfiles/ads/showads.aspx?adsid=" + adsid, function (data) { $("#" + adsid).html(data); }); } //显示热门新闻 function gettopnewslist(action) { $.post("/topnews.aspx?no-cache='+math.random()&" + action, function (data) { var arrreturnvalue = data.split('$$$'); if (arrreturnvalue[0] == "err") { $("#div_topnewslist").html("加载内容失败!"); } else { $("#div_topnewslist").html(arrreturnvalue[1]); } }); } //显示投票信息 function pubpostvote(activeid, tamp, container) { var act = "activeid=" + activeid + "&tamp=" + tamp; $.post("/survey/vote_show.aspx?no-cache='+math.random()&" + act, function (data) { $("#" + container).html(data); }); } var vote_flag = true; //提交投票 function sentvote(activeid) { var qdata = subvote(); if (vote_flag) { $("#submit_tip").html("正在提交....."); var purl = "/survey/vote_ajax.aspx?submitdata=" + qdata + "&activeid=" + activeid; $.post(purl + "&no-cache=" + math.random(), function (data) { document.location.href = "/survey/quest-suc.html"; }); } else { $("#submit_tip").css("display", "block"); $("#submit_tip").html("您某些题目填写的答案不符合本问卷的要求,页面将自动定位到不符合要求的题目,请检查!"); } } $$ = function (a, b) { if (b) { return b.getelementsbytagname(a); } else { return document.getelementsbytagname(a); } }; //获取提交数据 function subvote() { var pageholder = new array(); var q = new array(); var survey = document.getelementbyid("ctl00_contentplaceholder1_jq1_surveycontent"); pageholder = $$("fieldset", survey); for (var z = 0; z < pageholder.length; z++) { var e = $(".div_question"); for (var i = 0; i < e.length; i++) { var p = new array(); p._value = ""; p._flag = false; var obj = $$("input", e[i]).length > 0 ? $$("input", e[i]) : $$("textarea", e[i]); for (var j = 0; j < obj.length; j++) { switch (obj[0].type) { case "radio": p._type = obj[0].type; p._topic = i + 1; if (obj[j].checked) { p._value = obj[j].value; p._flag = true; } q[i] = p; break; case "checkbox": p._type = "check"; p._topic = i + 1; if (obj[j].checked) { p._value += obj[j].value + ","; p._flag = true; } q[i] = p; break; case "textarea": p._topic = i + 1; p._type = "question"; p._value = obj[j].value; p._flag = (p._value == "") ? false : true; q[i] = p; break; default: break; } } if (q[i] != undefined) { var strs = q[i]._value; q[i]._value = (q[i]._type == "check" && strs.length > 0) ? strs.substr(0, strs.length - 1) : strs; } } } var vote_num = 0; for (var k = 0; k < q.length; k++) { var vote_id = "div" + q[k]._topic; if (!q[k]._flag) { var obj = $("#" + vote_id + " .errormessage"); if (obj.length == 0) { $("#" + vote_id).css("border-color", "#ff9900"); $("#" + vote_id).append("
此题为必答题,请填写答案!
") } } else { $("#" + vote_id).css("border-color", "white"); $("#" + vote_id + " .errormessage").remove(); vote_num++; } } vote_flag = (vote_num == q.length) ? true : false; var spchars = ["$", "}", "^", "|", "<"]; var qchar = ""; for (var s = 0; s < q.length; s++) { if (s > 0) { qchar += spchars[1]; } qchar += q[s]._type; qchar += spchars[0]; qchar += q[s]._topic; qchar += spchars[0]; qchar += q[s]._value; } return qchar; } //提交投票信息 function pubtjvote(tid) { var act = $("#voteform").serialize(); var purl = "/survey/vote_ajax.aspx?tid=" + tid; var x = document.getelementbyid('itemsinput'); if (!x) { //没有这个参数 purl = purl + "&" + act; } else { purl = purl + "&" + act + "&itemsinput=" + $("#itemsinput").value; } $.post(purl + "&no-cache=" + math.random(), function (data) { $("#ajax_tpinfo").html(data); }); } //公共ajax取数据 function pubpostajax(url, actionstr, divid) { document.getelementbyid(divid).innerhtml = "保存中..."; var action = actionstr; var options = { method: 'get', parameters: action, oncomplete: function (transport) { var returnvalue = transport.responsetext; if (returnvalue.indexof("??") > -1) document.getelementbyid(divid).innerhtml = '保存失败'; else document.getelementbyid(divid).innerhtml = returnvalue; } }; new ajax.request(url + '?no-cache=' + math.random(), options); } function getcommentlistcontent(urlsitedomain, newsid, page) { var action = 'newsid=' + newsid + '&commenttype=getlist&showdiv=0&page=' + page; var options = { method: 'get', parameters: action, oncomplete: function (transport) { var returnvalue = transport.responsetext; if (returnvalue.indexof("??") > -1) document.getelementbyid("commentlistpage").innerhtml = '加载评论列表失败'; else document.getelementbyid("commentlistpage").innerhtml = returnvalue; } }; new ajax.request('' + urlsitedomain + '/comment.aspx?no-cache=' + math.random(), options); } function getcommentlist(page, newsid, chid) { $.get('/comment.aspx?no-cache=' + math.random() + '&id=' + newsid + '&chid=' + chid + '&commenttype=getcommentlist&page=' + page, function (returnvalue) { if (returnvalue.indexof('??') > -1) { returnvalue = '加载评论列表失败'; } $("#div_commentlist").html(returnvalue); }); } //显示计数器数字 function counter(countid) { var refurl = document.referrer; //获取来源地址 var fls = flashchecker(); //检测是否支持swf var flashv = '0'; if (fls.f) { flashv = fls.v }; var url = '/stat/stat.aspx?code=3&statid=' + countid + '&come=' + escape(refurl) + '&width=' + screen.width + '&height=' + screen.height + '&flashv=' + flashv + '&no-cache=' + math.random(); // $("#" + divid).html(url); $.get(url, function (returnvalue) { if (returnvalue.indexof('$$$') > -1) { var arrreturnvalue = returnvalue.split('$$$'); //返回结果 $("#today" + countid).html(arrreturnvalue[0]); $("#all" + countid).html(arrreturnvalue[1]); $("#user" + countid).html(arrreturnvalue[2]); $("#online" + countid).html(arrreturnvalue[3]); } else { $("#today" + countid).html("0"); $("#all" + countid).html("0"); $("#user" + countid).html("0"); $("#online" + countid).html("0"); } }); } //监测是否案件swf播放器 function flashchecker() { var hasflash = 0; //是否安装了flash var flashversion = 0; //flash版本 if (document.all) { var swf = new activexobject('shockwaveflash.shockwaveflash'); if (swf) { hasflash = 1; vswf = swf.getvariable("$version"); flashversion = parseint(vswf.split(" ")[1].split(",")[0]); } } else { if (navigator.plugins && navigator.plugins.length > 0) { var swf = navigator.plugins["shockwave flash"]; if (swf) { hasflash = 1; var words = swf.description.split(" "); for (var i = 0; i < words.length; ++i) { if (isnan(parseint(words[i]))) continue; flashversion = parseint(words[i]); } } } } return { f: hasflash, v: flashversion }; } //代理 function proxy(act, divid) { var url = '/proxy/proxy.aspx?siteid=0&case=' + act; $.get(url, function (returnvalue) { $("#" + divid).html(returnvalue); }); } //加载评论表单 function getaddcommentform(newsid, chid) { var action = 'id=' + newsid + '&chid=' + chid + '&commenttype=getaddcommentform'; $.get('/comment.aspx?no-cache=' + math.random() + '&' + action, function (returnvalue) { var arrreturnvalue = returnvalue.split('$$$'); if (arrreturnvalue[0] == "err") $("#div_commentform").html('加载评论表单失败!'); else $("#div_commentform").html(arrreturnvalue[1]); }); } //提交评论 function commandsubmit(obj) { if (obj.usernum.value == "") { alert('帐号不能为空'); return false; } if (obj.content.value == "") { alert('评论内容不能为空'); return false; } var r = obj.commtype; var commtypevalue = '2'; for (var i = 0; i < r.length; i++) { if (r[i].checked) commtypevalue = r[i].value; } var action = 'commenttype=addcomment&usernum=' + escape(obj.usernum.value) + '&userpwd=' + escape(obj.userpwd.value) + '&commtype=' + escape(commtypevalue) + '&content=' + escape(obj.content.value) + '&isqid=' + escape(obj.isqid.value) + '&id=' + obj.id.value; $.get('/comment.aspx?no-cache=' + math.random() + '&' + action, function (returnvalue) { var arrreturnvalue = returnvalue.split('$$$'); if (arrreturnvalue[0] == "err") { alert(arrreturnvalue[1]); getaddcommentform(obj.id.value, obj.chid.value); } else { alert('发表评论成功!'); $("#div_commentlist").html(arrreturnvalue[1]); getaddcommentform(obj.id.value, obj.chid.value); } }); } function commentloginout(newsid) { var login_out = '/comment.aspx?no-cache=' + math.random() + '&commenttype=loginout&id=' + newsid; $.get(login_out, function (returnvalue) { var arrreturnvalue = returnvalue.split('$$$'); if (arrreturnvalue[0] == "err") { alert('未知错误!'); } else { $("#div_commentform").html(arrreturnvalue[1]); } }); } //获得页面转向 function getpageinfourlfilename(type) { if (type == "0") { var v1 = document.location.pathname; var temp_f = v1.lastindexof("/"); var fien = v1.substring(temp_f + 1, v1.length) if (fien.indexof("_") > -1) { for (var i = 0; i < document.getelementbyid('pageselectoption').length; i++) { if (fien == document.getelementbyid('pageselectoption').options[i].value) { document.getelementbyid('pageselectoption').options[i].selected = true; } } } } else { var v1 = document.location.href; var temp_f = v1.lastindexof("="); var fien = v1.substring(temp_f + 1, v1.length) if (v1.lastindexof("=") > -1) { for (var i = 0; i < document.getelementbyid('pageselectoption').length; i++) { document.getelementbyid('pageselectoption').options[fien - 1].selected = true; } } else { document.getelementbyid('pageselectoption').options[0].selected = true; } } } //重新加载表单元素 function jsreloader(id, src) { var oldscript = document.getelementbyid(id); var parentnode = oldscript.parentnode; parentnode.removechild(oldscript); oldscript = null; var newscript = document.createelement("script"); newscript.type = "text/javascript"; newscript.src = src; newscript.id = id; parentnode.appendchild(newscript); } //收藏页面 function sethome(obj, url) { try { obj.style.behavior = 'url(#default#homepage)'; obj.sethomepage(url); } catch (e) { if (window.netscape) { try { netscape.security.privilegemanager.enableprivilege("universalxpconnect"); } catch (e) { alert("抱歉,此操作被浏览器拒绝!\n\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'"); } } else { alert("抱歉,您所使用的浏览器无法完成此操作。\n\n您需要手动将【" + url + "】设置为首页。"); } } } //收藏本站 function addfavorite(title, url) { try { window.external.addfavorite(url, title); } catch (e) { try { window.sidebar.addpanel(title, url, ""); } catch (e) { alert("抱歉,您所使用的浏览器无法完成此操作。\n\n加入收藏失败,请使用ctrl+d进行添加"); } } }