Alert refreshes page

Alert refreshes page

Not sure why but when I click the OK button for the function it refreshes the entire page instead of going to the field as a focus.


  
  1. function IsNumeric(item, message, scrollTo, focus) {
  2.     var numExp = /[0-9 -()+]+$/;
  3.     var aReturn;
  4.     aReturn = $('#' + item).val().match(numExp);
  5.     if (message && !aReturn) alert(message);
  6.     if (scrollTo && !aReturn) ScrollToPosition(0, scrollTo);
  7.     if (focus && !aReturn) { $('#' + item).focus(); ScrollToElement(item); }
  8.     return aReturn;
  9. }
  10. function IsAlpha(item, message, scrollTo, focus) {
  11.     var alphaExp = /^[a-zA-Z]+$/;
  12.     var aReturn;
  13.     aReturn = $('#' + item).val().match(alphaExp);
  14.     if (message && !aReturn) alert(message);
  15.     if (scrollTo && !aReturn) ScrollToPosition(0, scrollTo);
  16.     if (focus && !aReturn) { $('#' + item).focus(); ScrollToElement(item); }
  17.     return aReturn;
  18. }
  19. function IsValidEmail(item, message, scrollTo, focus) {
  20.     var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
  21.     var aReturn;
  22.     aReturn = $('#' + item).val().match(emailPattern);
  23.     if (message && !aReturn) alert(message);
  24.     if (scrollTo && !aReturn) ScrollToPosition(0, scrollTo);
  25.     if (focus && !aReturn) { $('#' + item).focus(); ScrollToElement(item); }
  26.     return aReturn;
  27. }
  28. function ScrollToElement(item) {
  29.     var el = $.browser.opera ? $("html") : $("html, body");
  30.     var aTop;
  31.     if ($('#' + item).offset())
  32.         aTop = $('#' + item).offset().top;
  33.     else
  34.         aTop = document.getElementById(item).offsetParent.offsetTop;
  35.     //alert(aTop);
  36.     el.animate({ scrollTop: aTop }, 'slow');
  37. }
  38. function ScrollToPosition(x, y) {
  39.     var el = $.browser.opera ? $("html") : $("html, body");
  40.     el.animate({ scrollTop: y }, 'slow');
  41. }

  42.         aReturn = IsNumeric('RentalContactsZip'"Please enter a valid zip code."nulltrue);
  43.         if (!aReturn) return aReturn;