js.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. $(function() {
  2. $(".filterSearch").change(function() {
  3. var cururl = window.location.href;
  4. var fliter = $(this).attr("name").toString();
  5. var fliterval = $(this).val();
  6. var separator = cururl.indexOf('?') !== -1 ? "&": "?";
  7. var re = new RegExp("([?&])");
  8. var urlarr;
  9. var newurl = "";
  10. if (cururl.indexOf(fliter) > 0) {
  11. urlarr = cururl.split(re);
  12. for (i = 0; i < urlarr.length; i++) {
  13. urlarr[i] = urlarr[i].indexOf(fliter) ? urlarr[i] : fliter + "=" + fliterval;
  14. urlarr[i] = urlarr[i].indexOf("Page") ? urlarr[i] : "Page=1";
  15. newurl = newurl + urlarr[i];
  16. }
  17. } else {
  18. newurl = cururl + separator + fliter + "=" + fliterval;
  19. }
  20. window.location.href = newurl;
  21. })
  22. $(".code").click(function(){
  23. var sltid=".code"+$(this).data("id")+"__panel";
  24. if ($(sltid).hasClass("showPanel"))
  25. {$(sltid).removeClass("showPanel").hide();}
  26. else
  27. {$(sltid).addClass("showPanel").show();}
  28. })
  29. })
  30. function chkboxall(t0,t1){
  31. ischk = t0.checked;
  32. for (var i=0;i<$("input[type=checkbox][name="+t1+"]").size();i++ ){ $("input[type=checkbox][name="+t1+"]").eq(i).attr("checked",ischk); }
  33. }
  34. function postchk(t){
  35. var $form = document.getElementById('form1'),
  36. chkact = parseInt(document.getElementById("chkact").value),
  37. ischk = false;
  38. for (var i=0;i<$form.elements.length;i++){
  39. if($form.elements[i].name=="chkbox" && $form.elements[i].checked == true){ischk = true;}
  40. }
  41. if(!ischk){alert('请至少选择一条数据');return false;}
  42. switch(t){
  43. case 1:
  44. switch(chkact){
  45. case 1:
  46. if(confirm('确认要设置所选状态为【显示】吗?'))$form.submit();
  47. break;
  48. case 0:
  49. if(confirm('确认要设置所选状态为【隐藏】吗?'))$form.submit();
  50. break;
  51. default:
  52. if(confirm('确认要删除吗?\n删除后不可恢复'))$form.submit();
  53. }
  54. break;
  55. case 2:
  56. switch(chkact){
  57. case 1:
  58. if(confirm('确认要设置所选状态为【正常】吗?'))$form.submit();
  59. break;
  60. case 0:
  61. if(confirm('确认要设置所选状态为【隐藏】吗?'))$form.submit();
  62. break;
  63. default:
  64. if(confirm('确认要删除吗?\n删除后不可恢复'))$form.submit();
  65. }
  66. break;
  67. case 3:
  68. switch(chkact){
  69. case 1:
  70. if(confirm('确认要设置所选状态为【已读】吗?'))$form.submit();
  71. break;
  72. case 0:
  73. if(confirm('确认要设置所选状态为【未读】吗?'))$form.submit();
  74. break;
  75. default:
  76. if(confirm('确认要删除吗?\n删除后不可恢复'))$form.submit();
  77. }
  78. break;
  79. default:
  80. return false;
  81. }
  82. return false;
  83. }
  84. function postchk_new(t){
  85. var $form = document.getElementById('form1'),
  86. chkact = parseInt(document.getElementById("chkact").value),
  87. ischk = false;
  88. for (var i=0;i<$form.elements.length;i++){
  89. if($form.elements[i].name=="chkbox[]" && $form.elements[i].checked == true){ischk = true;}
  90. }
  91. if(!ischk){alert('请至少选择一条数据');return false;}
  92. switch(t){
  93. case 1:
  94. switch(chkact){
  95. case 1:
  96. if(confirm('确认要设置所选状态为【显示】吗?'))$form.submit();
  97. break;
  98. case 0:
  99. if(confirm('确认要设置所选状态为【隐藏】吗?'))$form.submit();
  100. break;
  101. default:
  102. if(confirm('确认要删除吗?\n删除后不可恢复'))$form.submit();
  103. }
  104. break;
  105. case 2:
  106. switch(chkact){
  107. case 1:
  108. if(confirm('确认要设置所选状态为【正常】吗?'))$form.submit();
  109. break;
  110. case 0:
  111. if(confirm('确认要设置所选状态为【隐藏】吗?'))$form.submit();
  112. break;
  113. default:
  114. if(confirm('确认要删除吗?\n删除后不可恢复'))$form.submit();
  115. }
  116. break;
  117. case 3:
  118. switch(chkact){
  119. case 1:
  120. if(confirm('确认要设置所选状态为【已读】吗?'))$form.submit();
  121. break;
  122. case 0:
  123. if(confirm('确认要设置所选状态为【未读】吗?'))$form.submit();
  124. break;
  125. default:
  126. if(confirm('确认要删除吗?\n删除后不可恢复'))$form.submit();
  127. }
  128. break;
  129. default:
  130. return false;
  131. }
  132. return false;
  133. }
  134. function subform(){
  135. $("#form1").submit();
  136. }
  137. function subform2(){
  138. var p1=$("#em_password").val();
  139. var p2=$("#re_password").val();
  140. if(p1!==p2)
  141. {alert("密码与重复密码不一致!"); return false;}
  142. return true;
  143. }
  144. function flcountry(){
  145. var country=$("#Country").val();
  146. if(country==""||country==null)
  147. {location.href="customers.php";}
  148. else
  149. {location.href="?country="+escape(country);}
  150. }
  151. function flchanel(){
  152. var chanel=$("#Chanel").val();
  153. if(chanel==""||chanel==null)
  154. {location.href="customers.php";}
  155. else
  156. {location.href="?chanel="+escape(chanel);}
  157. }
  158. function flemployee(){
  159. var employee=$("#Employee").val();
  160. if(employee==""||employee==null)
  161. {location.href="customers.php";}
  162. else
  163. {location.href="?employee="+escape(employee);}
  164. }
  165. function fldeal(){
  166. var deal=$("#deal").val();
  167. if(deal==""||deal==null)
  168. {location.href="customers.php";}
  169. else
  170. {location.href="?deal="+escape(deal);}
  171. }