home *** CD-ROM | disk | FTP | other *** search
/ Online Praxis 1998 March / Image.iso / CD-ROM / NETSCAPE / CCK / CONF_ED.Z / cejs.jar / gentools.js < prev    next >
Encoding:
JavaScript  |  1998-02-12  |  1.0 KB  |  52 lines

  1. // Copyright (C) 1996, 1997 Netscape Communications Corporation, All rights reserved.
  2.  
  3. var debugOutput = false;
  4.  
  5. // Displays a message only when debugging.
  6. function dbgMsg(message) {
  7.    if(debugOutput)
  8.       java.lang.System.out.println(message) ;
  9. }
  10.  
  11.  
  12. function isANumber (checkstring)
  13. {
  14.   for (var i=0; i<checkstring.length; i++)
  15.   {
  16.     if (isNaN(parseInt(checkstring.substring(i,i+1))))
  17.       return false
  18.   }
  19.   return(true);
  20. }
  21.  
  22. function verifyIsANumber(field)
  23. {
  24.  
  25.   if (! isANumber(field.value))
  26.   {
  27.     alert("This field must contain a number");
  28.     field.focus();
  29.   }
  30. }
  31.  
  32. function verifyIsTrueFalse(field)
  33. {
  34.  
  35.   if ( (field.value != 'true') && (field.value != 'false') )
  36.   {
  37.     alert("This field must contain 'true' or 'false'");
  38.     field.focus();
  39.   }
  40. }
  41.  
  42. function verifyIsMode(field)
  43. {
  44.  
  45.   if ( (field.value != 'window') && (field.value != 'full') && (field.value != 'webtop'))
  46.   {
  47.     alert("This field must contain 'window', 'full' or 'webtop' ");
  48.     field.focus();
  49.   }
  50. }
  51.  
  52.