home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / Chip_2001-06_cd1.bin / internet / ukazky / eur_soubory / europen.js < prev    next >
Encoding:
JavaScript  |  2001-04-18  |  2.0 KB  |  69 lines

  1. //image
  2. function ButtonChange (a_img, a_sw) {
  3.         l_Img = new Image();
  4.         if (a_sw == 0) {
  5.                 l_Img.src =  a_img + 'off.gif';
  6.         }
  7.         if (a_sw == 1) {
  8.                 l_Img.src =  a_img + 'on.gif';
  9.         }
  10.         if (a_sw == 2) {
  11.                 l_Img.src =  a_img + 'sel.gif';
  12.         }
  13.         document.images[a_img].src = l_Img.src;
  14. }
  15.  
  16. //prihlaska
  17. function isEmpty(theField) {
  18.         if (theField.value == "") {
  19.                 return true;
  20.         }
  21.         else    {
  22.                 return false;
  23.         }
  24. }
  25.  
  26. function isRequired(thisForm) {
  27.         var Empty = false
  28.  
  29.         if (isEmpty(thisForm.Jmeno)) {
  30.                 alert("JmΘno - nutno vyplnit...");
  31.                 Empty = true;
  32.         }
  33.         if (Empty == false && isEmpty(thisForm.Prijmeni) == true) {
  34.                 alert("P°φjmenφ - nutno vyplnit...");
  35.                 Empty = true;
  36.         }
  37.         if (Empty == false && isEmpty(thisForm.Bydliste) == true && isEmpty(thisForm.Firma) == true) {
  38.                 alert("BydliÜt∞ nebo adresu firmy - nutno vyplnit...");
  39.                 Empty = true;
  40.         }
  41.          if (Empty == false && isEmpty(thisForm.Telefon) == true) {
  42.                 alert("Telefon - nutno vyplnit...");
  43.                 Empty = true;
  44.         }
  45.          if (Empty == false && isEmpty(thisForm.Email) == true) {
  46.                 alert("E-mail - nutno vyplnit...");
  47.                 Empty = true;
  48.         }
  49. }
  50.  
  51. function isPhone(theField) {
  52.  
  53.         var theInput = theField.value;
  54.         var theLength = theInput.length;
  55.         var goodPhone = true;
  56.  
  57.         for (var i = 0; i < theLength; i++) {
  58.                 var theChar = theInput.substring(i,i+1)
  59.                 if (theChar != " ") {
  60.                         if (theChar < "0" || theChar > "9") {
  61.                                 goodPhone = false;
  62.                         }
  63.                 }
  64.         }
  65.         if(goodPhone == false) {
  66.                 alert("Toto nenφ korektnφ Φφslo: " + theInput);
  67.         }
  68.  }
  69.