js.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 subform(){
  85. $("#form1").submit();
  86. }
  87. function subform2(){
  88. var p1=$("#em_password").val();
  89. var p2=$("#re_password").val();
  90. if(p1!==p2)
  91. {alert("密码与重复密码不一致!"); return false;}
  92. return true;
  93. }
  94. function flcountry(){
  95. var country=$("#Country").val();
  96. if(country==""||country==null)
  97. {location.href="customers.php";}
  98. else
  99. {location.href="?country="+escape(country);}
  100. }
  101. function flchanel(){
  102. var chanel=$("#Chanel").val();
  103. if(chanel==""||chanel==null)
  104. {location.href="customers.php";}
  105. else
  106. {location.href="?chanel="+escape(chanel);}
  107. }
  108. function flemployee(){
  109. var employee=$("#Employee").val();
  110. if(employee==""||employee==null)
  111. {location.href="customers.php";}
  112. else
  113. {location.href="?employee="+escape(employee);}
  114. }
  115. function fldeal(){
  116. var deal=$("#deal").val();
  117. if(deal==""||deal==null)
  118. {location.href="customers.php";}
  119. else
  120. {location.href="?deal="+escape(deal);}
  121. }