topical media & game development

talk show tell print

basic-javascript-03-ch3-examp2.htm / htm



  <html>
  <body>
  
  <script language="JavaScript" type="text/javascript">
  
  var myAge = Number(prompt("Enter your age",30));
  
  if (myAge >= 0 && myAge <= 10)
  {
     document.write("myAge is between 0 and 10<br>");
  }
  
  if ( !(myAge >= 0 && myAge <= 10) )
  {
     document.write("myAge is NOT between 0 and 10<br>");
  }
  
  if ( myAge >= 80 || myAge <= 10 )
  {
     document.write("myAge is 80 or above OR 10 or below<br>");
  }
  
  if ( (myAge >= 30 && myAge <= 39) || (myAge >= 80 && myAge <= 89) )
  {
     document.write("myAge is between 30 and 39 or myAge is between 80 and 89");
  }
  
  </script>
  
  </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.