home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / JanaSetup.exe / admin / pruefen_js / dhcp_server.js < prev    next >
Encoding:
Text File  |  2006-05-08  |  2.0 KB  |  114 lines

  1. function send()
  2. {
  3.     if (pruefen() == true)
  4.         document.forms[1].submit();
  5. }
  6.  
  7. /**/
  8.  
  9. function pruefen()
  10. {
  11.     var f1 = document.forms[1].T1;
  12.     var f2 = document.forms[1].T2;
  13.     var f4 = document.forms[1].T4;
  14.     var f5 = document.forms[1].T5;
  15.     var f7 = document.forms[1].T7;
  16.  
  17.     if ((f1.value.match(/\D/) != null) || (f1.value < 1))
  18.     {
  19.         alert(txt[42][6]  + ' ' +  txt[76][16] + ' "' + txt[76][12] + '"!');
  20.         f1.select();
  21.         f1.focus();
  22.         return false;
  23.     }
  24.  
  25.     if ((f2.value.match(/\D/) != null) || (f2.value < 1))
  26.     {
  27.         alert(txt[42][6] + ' ' + txt[76][16] + ' "' + txt[76][13] + '"!');
  28.         f2.select();
  29.         f2.focus();
  30.         return false;
  31.     }
  32.  
  33.     if ((f4.value != '') && (check_ip(1, 'T4') == false))
  34.         return false;
  35.  
  36.     if ((f5.value != '') && (check_ip(1, 'T5') == false))
  37.         return false;
  38.  
  39.     if (check_ip(1, 'T6') == false)
  40.         return false;
  41.  
  42.     if ((f7.value != '') && (check_ip(1, 'T7') == false))
  43.         return false;
  44.  
  45.     return true;
  46. }
  47.  
  48. /**/
  49.  
  50. function pruefen_2(az, bz)
  51. {
  52.     var f1 = document.forms[2].elements[bz];
  53.     var f2 = document.forms[2].elements[bz + 1];
  54.     var vb = new Array(',', '|', '\'', '"');
  55.  
  56.     if (az == 1)
  57.     {
  58.         if (check_ip(2, bz) == false)
  59.             return false;
  60.  
  61.         if ((f2.value != '') && (check_ip(2, (bz + 1)) == false))
  62.             return false;
  63.     }
  64.     else
  65.     {
  66.         if (f1.value != '')
  67.         {
  68.             for (i = 0; i < vb.length; i++)
  69.             {
  70.                 if (f1.value.indexOf(vb[i]) != -1)
  71.                 {
  72.                     alert(txt[5][7] + vb[i] + txt[5][8]);
  73.                     f1.select();
  74.                     f1.focus();
  75.                     return false;
  76.                 }
  77.             }
  78.  
  79.             if (check_ip(2, (bz + 1)) == false)
  80.                 return false;
  81.         }
  82.     }
  83. }
  84.  
  85. /**/
  86.  
  87. function check_ip(fr, fe)
  88. {
  89.     var fx = document.forms[fr].elements[fe];
  90.     var ip = fx.value.split('.');
  91.  
  92.     if (ip.length != 4)
  93.     {
  94.         alert(fx.value + ', ' + txt[18][27]);
  95.         fx.select();
  96.         fx.focus();
  97.         return false;
  98.     }
  99.     else
  100.     {
  101.         for (i = 0; i < ip.length; i++)
  102.         {
  103.             if ((isNaN(ip[i]) == true) || (ip[i] == '') || (ip[i] < 0) || (ip[i] > 255))
  104.             {
  105.                 alert(fx.value + ', ' + txt[18][27]);
  106.                 fx.select();
  107.                 fx.focus();
  108.                 return false;
  109.             }
  110.         }
  111.     }
  112.  
  113.     return true;
  114. }