Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function swapValues(el1, el2)
  2. {
  3.   var t = el1.value; el1.value = el2.value; el2.value = t;
  4. }
  5.  
  6. function jumpTo(name)
  7. {
  8.   var el = document.loginform.elements[name];
  9.   if (el != null && el.value == "") {
  10.     el.focus();
  11.     return true;
  12.   }
  13.   return false;
  14. }
  15.  
  16. function onEnter()
  17. {
  18.   // if all input fields are filled, submit the form;
  19.   // otherwise jump to a next empty input field
  20.   (typeof jumpToFirstEmptyInputField == "function" &&
  21.    jumpToFirstEmptyInputField()) ||
  22.   (typeof document.loginform == "object" &&
  23.    document.loginform.submit());
  24. }
  25.  
  26. function focusIn(el)
  27. {
  28.   if (el != null && !el.disabled)
  29.     el.style.backgroundColor = "#FFF09E";
  30. }
  31.  
  32. function focusOut(el)
  33. {
  34.   if (el != null && !el.disabled)
  35.     el.style.backgroundColor = "";
  36. }
  37.  
  38. function pair(name, value)
  39. {
  40.   return {'name':name, 'value':value};
  41. }
  42.  
  43. function submit(arr, allow_empty_fields)
  44. {
  45.   for (var i in arr) {
  46.     var el = arr[i];
  47.     if (document.loginform.elements[el.name] != null)
  48.       document.loginform.elements[el.name].value = el.value;
  49.   }
  50.  
  51.   if (typeof allow_empty_fields == "undefined" ||
  52.       allow_empty_fields == false)
  53.     return onEnter();
  54.  
  55.   return document.loginform.submit();
  56. }
  57.  
  58. function submitOkCode(value, allow_empty_fields)
  59. {
  60.   return submit([pair('~okcode', value)], allow_empty_fields);
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement