Advertisement
Guest User

Untitled

a guest
Sep 10th, 2011
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var xmlhttp;
  2.  
  3. function getXHO() {
  4.     if (window.XMLHttpRequest) {
  5.         return new XMLHttpRequest();
  6.     }
  7.     if (window.ActiveXObject) {
  8.         return new ActiveXObject("Microsoft.XMLHTTP");
  9.     }
  10.     return null;
  11. }
  12.  
  13. function updateText(url, div) {
  14.     xmlhttp = getXHO();
  15.     xmlhttp.onreadystatechange = function () {
  16.         document.getElementById(div).innerHTML = xmlhttp.responseText;
  17.     }
  18.     xmlhttp.open("GET", url, false);
  19.     xmlhttp.send();
  20. }
  21.  
  22. function change(x) {
  23.     var e = x.split("#");
  24.     var a = e[1];
  25.     v = "textfiles/" + a + ".php";
  26.     updateText(v, 'content');
  27. }
  28.  
  29. function showInfo(person) {
  30.     xmlhttp = getXHO();
  31.     xmlhttp.onreadystatechange = function () {
  32.         document.getElementById('a').innerHTML = xmlhttp.responseText;
  33.     }
  34.     xmlhttp.open("GET", 'textfiles/bios/get.php?person=' + person, false);
  35.     xmlhttp.send();
  36. }
  37.  
  38. function updateQt(qt, p) {
  39.     xmlhttp = getXHO();
  40.     xmlhttp.onreadystatechange = function () {
  41.         if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
  42.             var x = xmlhttp.responseText;
  43.             var e = x.split('%');
  44.             document.getElementById('p').innerHTML = '$' + e[1];
  45.             document.getElementById('t').innerHTML = '$' + e[0];
  46.         }
  47.     }
  48.     xmlhttp.open("GET", '/shop/update.php?qt=' + qt + '&p=' + p, false);
  49.     xmlhttp.send();
  50. }
  51.  
  52. function validate(theField, name, filter) {
  53.     if (theField.value == "") {
  54.         theField.style.background = '#FFFFFF';
  55.         return false;
  56.     }
  57.     if (filter.test(theField.value)) {
  58.         theField.style.background = '#D6FFD8';
  59.     } else {
  60.         theField.style.background = '#FFD6D6';
  61.         alert('Invalid input in ' + name);
  62.     }
  63. }
  64.  
  65. function validateUsername(theField, name, filter) {
  66.     if (filter.test(theField.value)) {
  67.         var e = document.getElementById('email').value.split('@');
  68.         var a = e[0];
  69.         if (theField.value == a) {
  70.             theField.style.background = '#FFD6D6';
  71.             alert('Username can\'t be the same as email address');
  72.         } else {
  73.             theField.style.background = '#D6FFD8';
  74.         }
  75.     } else {
  76.         theField.style.background = '#FFD6D6';
  77.         alert('Invalid input in ' + name);
  78.     }
  79. }
  80.  
  81. function pass(theField) {
  82.     var p = document.getElementById('password');
  83.     if (theField.value != p.value) {
  84.         theField.style.background = '#FFD6D6';
  85.         p.style.background = '#FFD6D6';
  86.         alert('Passwords don\'t match!');
  87.     } else {
  88.         theField.style.background = '#D6FFD8';
  89.         p.style.background = '#D6FFD8';
  90.     }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement