fcode.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. var Validate = function()
  2. {
  3. this.required = function(id)
  4. {
  5. var inputVal=$(id).val();
  6. if(inputVal=="") {
  7. return false;
  8. } else {
  9. return true;
  10. }
  11. };
  12. this.mobile = function (id)
  13. {
  14. var inputVal=$(id).val();
  15. var tel=new RegExp("^[1][3-8]+\\d{9}");
  16. if(tel.test(inputVal)) {
  17. return true;
  18. } else {
  19. return false;
  20. }
  21. }
  22. };
  23. var CountDown = function(time)
  24. {
  25. if(isNaN(time)) {
  26. return;
  27. }
  28. this.time = time;
  29. this.countDown = function()
  30. {
  31. if(this.isStart())
  32. {
  33. return false;
  34. }
  35. else
  36. {
  37. var that=this;
  38. var target=event.target;
  39. var time = parseInt(that.time);
  40. var a = setInterval(function()
  41. {
  42. time = time - 1;
  43. target.innerHTML = time;
  44. if(time <= 0) {
  45. clearInterval(a);
  46. target.innerHTML = '重新发送';
  47. }
  48. },1000);
  49. }
  50. };
  51. this.isStart = function()
  52. {
  53. var target = event.target;
  54. if(target.innerHTML == '重新发送' || target.innerHTML == '获取验证码') {
  55. return false;
  56. } else {
  57. return true;
  58. }
  59. }
  60. };
  61. var ajaxServer = function(type,url,data,callback)
  62. {
  63. $.ajax({
  64. type:type,
  65. dataType:'json',
  66. url:url,
  67. data:data,
  68. success:callback
  69. });
  70. };
  71. var app = function()
  72. {
  73. var app=navigator.userAgent.toLowerCase(),//判断设备
  74. app_nav=navigator.appVersion.toLowerCase(),
  75. href='';
  76. if (app_nav.indexOf('iphone')>-1&&app.indexOf('iphone')){
  77. href='http://a.app.qq.com/o/simple.jsp?pkgname=com.lrlz.beautyshop';
  78. } else if (app.indexOf('micromessenger')>-1 && app_nav.indexOf('android')>-1) {
  79. href = "https://passport.lrlz.com/hfive/android_down/index.html";
  80. }
  81. else {
  82. href="javascript:void(0)";
  83. }
  84. return href;
  85. };