| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- //*HySoft.VIPSystem后台管理页JS函数,Jquery扩展
- //*作者:一些事情
- //*时间:2012年02月20日
- //=============================切换验证码======================================
- function ToggleCode(obj, codeurl) {
- $(obj).attr("src", codeurl + "?time=" + Math.random());
- }
- //表格隔行变色
- $(function () {
- $(".msgtable tr:nth-child(odd)").addClass("tr_odd_bg"); //隔行变色
- $(".msgtable tr").hover(
- function () {
- $(this).addClass("tr_hover_col");
- },
- function () {
- $(this).removeClass("tr_hover_col");
- }
- );
- });
- //==========================页面加载时JS函数结束===============================
- //===========================系统管理JS函数开始================================
- //Tab控制函数
- function tabs(tabId, tabNum) {
- //设置点击后的切换样式
- $(tabId + " .tab_nav li").removeClass("selected");
- $(tabId + " .tab_nav li").eq(tabNum).addClass("selected");
- //根据参数决定显示内容
- $(tabId + " .tab_con").hide();
- $(tabId + " .tab_con").eq(tabNum).show();
- }
- //可以自动关闭的提示
- function jsprint(msgtitle, url, msgcss, callback) {
- $("#msgprint").remove();
- var cssname = "";
- switch (msgcss) {
- case "Success":
- cssname = "pcent success";
- break;
- case "Error":
- cssname = "pcent error";
- break;
- default:
- cssname = "pcent warning";
- break;
- }
- var str = "<div id=\"msgprint\" class=\"" + cssname + "\">" + msgtitle + "</div>";
- $("body").append(str);
- $("#msgprint").show();
- var itemiframe = "#framecenter .l-tab-content .l-tab-content-item";
- var curriframe = "";
- $(itemiframe).each(function () {
- if ($(this).css("display") != "none") {
- curriframe = $(itemiframe).index($(this));
- return false;
- }
- });
- if (url == "back" && curriframe != "") {
- frames[curriframe].history.back(-1);
- } else if (url != "" && curriframe != "") {
- frames[curriframe].location.href = url;
- }
- //3秒后清除提示
- setTimeout(function () {
- $("#msgprint").fadeOut(500);
- //如果动画结束则删除节点
- if (!$("#msgprint").is(":animated")) {
- $("#msgprint").remove();
- }
- }, 3000);
- //执行回调函数
- if (typeof (callback) == "function") callback();
- }
- //全选取消按钮函数,调用样式如:
- function checkAll(chkobj){
- if($(chkobj).find("span b").text()=="全选")
- {
- $(chkobj).find("span b").text("取消");
- $(".checkall input").attr("checked", true);
- }else{
- $(chkobj).find("span b").text("全选");
- $(".checkall input").attr("checked", false);
- }
- }
- //全选取消按钮函数,调用样式如:
- function checkAllByName(chkobj) {
- if ($(chkobj).find("span b").text() == "全选") {
- $(chkobj).find("span b").text("取消");
- $("input[name=checkall]").attr("checked", true);
- } else {
- $(chkobj).find("span b").text("全选");
- $("input[name=checkall]").attr("checked", false);
- }
- }
- //执行回传函数
- function ExePostBack(objId, objmsg) {
- if ($(".checkall input:checked").size() < 1) {
- $.ligerDialog.warn("对不起,请选中您要操作的记录!");
- return false;
- }
- var msg = "删除记录后不可恢复,您确定吗?";
- if (arguments.length == 2) {
- msg = objmsg;
- }
- $.ligerDialog.confirm(msg, "提示信息", function (result) {
- if (result) {
- __doPostBack(objId, '');
- }
- });
- return false;
- }
- //关闭提示窗口
- function CloseTip(objId) {
- $("#" + objId).hide();
- }
- //打开Dialog窗口
- function openDialog(tit, sendUrl, w, h) {
- if (arguments.length == 3) {
- $.ligerDialog.open({ title: tit, url: sendUrl, width: w, isResize: true });
- } else if (arguments.length == 4) {
- $.ligerDialog.open({ title: tit, url: sendUrl, width: w, height: h, isResize: true });
- } else {
- $.ligerDialog.open({ title: tit, url: sendUrl, isResize: true });
- }
- }
- //只允许输入数字
- function checkNumber(e) {
- if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) { //FF
- if (!((e.which >= 48 && e.which <= 57) || (e.which >= 96 && e.which <= 105) || (e.which == 8) || (e.which == 46)))
- return false;
- } else {
- if (!((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) || (event.keyCode == 8) || (event.keyCode == 46)))
- event.returnValue = false;
- }
- }
- //===========================系统管理JS函数结束================================
- //================上传文件JS函数开始,需和jquery.form.js一起使用===============
- //文件上传
- function Upload(action, repath, uppath, iswater, isthumbnail, filepath) {
- var sendUrl = "../../tools/upload_ajax.ashx?action=" + action + "&ReFilePath=" + repath + "&UpFilePath=" + uppath;
- //判断是否打水印
- if(arguments.length == 4){
- sendUrl = "../../tools/upload_ajax.ashx?action=" + action + "&ReFilePath=" + repath + "&UpFilePath=" + uppath + "&IsWater=" + iswater;
- }
- //判断是否生成宿略图
- if (arguments.length == 5) {
- sendUrl = "../../tools/upload_ajax.ashx?action=" + action + "&ReFilePath=" + repath + "&UpFilePath=" + uppath + "&IsWater=" + iswater + "&IsThumbnail=" + isthumbnail;
- }
- //自定义上传路径
- if (arguments.length == 6) {
- sendUrl = filepath + "tools/upload_ajax.ashx?action=" + action + "&ReFilePath=" + repath + "&UpFilePath=" + uppath + "&IsWater=" + iswater + "&IsThumbnail=" + isthumbnail;
- }
- //开始提交
- $("#form1").ajaxSubmit({
- beforeSubmit: function(formData, jqForm, options){
- //隐藏上传按钮
- $("#"+repath).nextAll(".files").eq(0).hide();
- //显示LOADING图片
- $("#"+repath).nextAll(".uploading").eq(0).show();
- },
- success: function(data, textStatus) {
- if (data.msg == 1) {
- $("#"+repath).val(data.msgbox);
- } else {
- $.ligerDialog.alert(data.msgbox, '提示', "warm");
- }
- $("#"+repath).nextAll(".files").eq(0).show();
- $("#"+repath).nextAll(".uploading").eq(0).hide();
- },
- error: function(data, status, e) {
- $.ligerDialog.alert("上传失败,错误信息:" + e, '提示', "error");
- $("#"+repath).nextAll(".files").eq(0).show();
- $("#"+repath).nextAll(".uploading").eq(0).hide();
- },
- url: sendUrl,
- type: "post",
- dataType: "json",
- timeout: 600000
- });
- };
- //附件上传
- function AttachUpload(repath, uppath) {
- var submitUrl = "../../tools/upload_ajax.ashx?action=AttachFile&UpFilePath=" + uppath;
- //开始提交
- $("#form1").ajaxSubmit({
- beforeSubmit: function (formData, jqForm, options) {
- //隐藏上传按钮
- $("#" + uppath).parent().hide();
- //显示LOADING图片
- $("#" + uppath).parent().nextAll(".uploading").eq(0).show();
- },
- success: function (data, textStatus) {
- if (data.msg == 1) {
- var listBox = $("#" + repath + " ul");
- var newLi = '<li>'
- + '<input name="hidFileName" type="hidden" value="0|' + data.mstitle + "|" + data.msgbox + '" />'
- + '<b class="close" title="删除" onclick="DelAttachLi(this);"></b>'
- + '<span class="right"> </span><a href="javascript:;" class="upfile right"><input type="file" name="FileUpdate" onchange="AttachUpdate(\'hidFileName\',this);" /></a>'
- + '<span class="right" >标题:<input name="txtFileTitle" type="text" style="width:120px;" class="input2" value="标题" /></span>'
- + '<span class="title">附件:' + data.mstitle + '</span>'
- + '<span style="display:none;">人气:0</span>'
- + '<span class="uploading">正在更新...</span>'
- + '</li>';
- listBox.append(newLi);
- } else {
- alert(data.msgbox);
- }
- $("#" + uppath).parent().show();
- $("#" + uppath).parent().nextAll(".uploading").eq(0).hide();
- },
- error: function (data, status, e) {
- alert("上传失败,错误信息:" + e);
- $("#" + uppath).parent().show();
- $("#" + uppath).parent().nextAll(".uploading").eq(0).hide();
- },
- url: submitUrl,
- type: "post",
- dataType: "json",
- timeout: 600000
- });
- };
- //更新附件上传
- function AttachUpdate(repath, uppath) {
- var btnOldName = $(uppath).attr("name");
- var btnNewName = "NewFileUpdate";
- $(uppath).attr("name", btnNewName);
- var submitUrl = "../../tools/upload_ajax.ashx?action=AttachFile&UpFilePath=" + btnNewName;
- //开始提交
- $("#form1").ajaxSubmit({
- beforeSubmit: function (formData, jqForm, options) {
- //隐藏上传按钮
- $(uppath).parent().hide();
- //显示LOADING图片
- $(uppath).parent().nextAll(".uploading").eq(0).show();
- },
- success: function (data, textStatus) {
- if (data.msg == 1) {
- var ArrFileName = $(uppath).parent().prevAll("input[name='" + repath + "']").val().split("|");
- $(uppath).parent().prevAll("input[name='" + repath + "']").val(ArrFileName[0] + "|" + data.mstitle + "|" + data.msgbox);
- $(uppath).parent().nextAll(".title").html("附件:" + data.mstitle);
- } else {
- alert(data.msgbox);
- }
- $(uppath).parent().show();
- $(uppath).parent().nextAll(".uploading").eq(0).hide();
- $(uppath).attr("name", btnOldName);
- },
- error: function (data, status, e) {
- alert("上传失败,错误信息:" + e);
- $(uppath).parent().show();
- $(uppath).parent().nextAll(".uploading").eq(0).hide();
- $(uppath).attr("name", btnOldName);
- },
- url: submitUrl,
- type: "post",
- dataType: "json",
- timeout: 600000
- });
- };
- //===========================上传文件JS函数结束================================
- //#region 获取url参数
- function GetUrlQuerying() {
- var args = new Object();
- var query = location.search.substring(1); // Get query string
- var pairs = query.split("&"); // Break at ampersand
- for (var i = 0; i < pairs.length; i++) {
- var pos = pairs[i].indexOf('='); // Look for "name=value"
- if (pos == -1) continue; // If not found, skip
- var argname = pairs[i].substring(0, pos); // Extract the name
- var value = pairs[i].substring(pos + 1); // Extract the value
- try {
- value = decodeURIComponent(value); // Decode it, if needed
- }
- catch (e) {
- value = unescape(value);
- }
- args[argname] = value; // Store as a property
- }
- return args; // Return the object
- }
- //#endregion
|