// 公共方法库 /* 功能: 操作控件中的内容 type: 0 减数据 1 加数据 controlName: 控件名称 objValue: 要操作的值 */ function addOrCutData(type, controlName, objValue){ if(type == 0){ var str = document.getElementById(controlName).value; str = str.replace(objValue + "|", "") document.getElementById(controlName).value = str; } else if(type == 1){ document.getElementById(controlName).value = document.getElementById(controlName).value + objValue + "|"; } } /* 功能: 数据列表进行分页 currentpage: 当前页 pageall: 总页数 fclick: 查询数据的方法名 */ function showPage(currentpage, pageall, fclick) { currentpage = parseInt(currentpage); pageall = parseInt(pageall); var begin, end; if (currentpage - 3 < 1) { begin = 1; end = (7 > pageall ? pageall : 7); } else { if (currentpage + 3 < pageall) { begin = currentpage - 3; end = currentpage + 3; } else { begin = (pageall - 7 > 1 ? pageall - 7 : 1); end = pageall; } } if (fclick == null) fclick = "showList"; var pagehtml = ''; if (currentpage > 1) pagehtml = '<span style="cursor:pointer;" mce_style="cursor:pointer;" οnclick="' + fclick + '(' + (currentpage - 1) + ');"><a href="javascript:void(0);" mce_href="javascript:void(0);">上一页</a></span>'; if (begin > 1) pagehtml += ' <a href="javascript:void(0);" mce_href="javascript:void(0);" οnclick="' + fclick + '(1);">' + 1 + '</a> '; if (begin > 2) pagehtml += '...'; for (var i = begin; i <= end; i++) { if (i == currentpage) pagehtml += ' <b>' + i + '</b> '; else pagehtml += ' <a href="javascript:void(0);" mce_href="javascript:void(0);" οnclick="' + fclick + '(' + i + ');">' + i + '</a> '; } if (pageall - end > 2) pagehtml += '...'; if (pageall - end > 0) pagehtml += ' <a href="javascript:void(0);" mce_href="javascript:void(0);" οnclick="' + fclick + '(' + pageall + ');">' + pageall + '</a> '; if (currentpage < pageall) pagehtml += '<span style="cursor:pointer;" mce_style="cursor:pointer;" οnclick="' + fclick + '(' + (currentpage + 1) + ');"><a href="javascript:void(0);" mce_href="javascript:void(0);">下一页</a></span>'; return pagehtml; } /* 功能: 获取地址栏参数 name: 参数名 return: 返回参数值 */ function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return ""; }