portal html css js resource

reg_h5.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*邀请好友*/
  2. $(function(){
  3. /*控制提示框样式*/
  4. function bombox(textt){
  5. $(".bomb-box").fadeIn("slow");
  6. $(".bomb-box").text(textt);
  7. var bombwidth = $(".bomb-box").width();
  8. $(".bomb-box").css({"marginLeft": -(bombwidth+25)/2 + "px"});
  9. setTimeout(function(){
  10. $(".bomb-box").fadeOut("slow");
  11. },4000);
  12. }
  13. /*校验提交按钮显示状态*/
  14. $('.form-group').on('keyup', "#username,#userphone,#usermail,#userorg", function() {
  15. if($("#username").val() == "" || $("#userphone").val() == "" || $("#usermail").val() == "" || $("#userorg").val() == "") {
  16. $("#regbtn").attr("disabled",true);
  17. } else {
  18. $("#regbtn").attr("disabled",false);
  19. }
  20. });
  21. /*注册按钮*/
  22. $("#regbtn").on('click',function() {
  23. var hunPhone = $("#userphone").val();
  24. var hunMail = $("#usermail").val();
  25. if(hunPhone.length!=11){
  26. bombox("请输入正确的手机号码");
  27. return;
  28. }else if(hunMail.indexOf("@")<0){
  29. bombox("请输入正确的邮箱地址");
  30. return;
  31. }
  32. completeReg();
  33. });
  34. //注册提交
  35. function completeReg() {
  36. $.ajax({
  37. url:"http://www.ekexiu.com:8080/portal/regcustom.jsp",
  38. data: {
  39. username:$("#username").val(),
  40. userphone: $("#userphone").val(),
  41. usermail: $("#usermail").val(),
  42. userorg: $("#userorg").val()
  43. },
  44. dataType : "jsonp",
  45. jsonp: "callback",
  46. async: false,
  47. success: function(data) {
  48. if(data.success) {
  49. bombox("您的信息提交成功!");
  50. $(".formblock").hide();
  51. $(".inviteSucceed").show();
  52. }
  53. },
  54. error: function() {
  55. bombox("服务器链接超时");
  56. }
  57. });
  58. }
  59. });