home

Javascript Conditional Stat Tutorial


Conditional Statements


 /*conditional statements are used to perform actions
  based on a condition.
  for conditional statemente the kewords are if, else, else if
  syntax of conditional statements:
  if(condition)
  {
   any action
  }
  else
  {
   any action
  }
  */
  var date = new Date()
  document.write(date)
  document.write("<BR>")
    
  var time = date.getHours()
  document.write(time)
  document.write("<BR>")
  
  if ( time ==15)
  {
   document.write("Hows your day?")
  }
  else
  {
   document.write("do you know whats the time?")
  }

      <script type="text/javascript">
/*conditional statements are used to perform actions
based on a condition.
for conditional statemente the kewords are if, else, else if
syntax of conditional statements:
if(condition)
{
any action
}
else
{
any action
}
*/
var date = new Date()
document.write(date)
document.write("<BR>")

var time = date.getHours()
document.write(time)
document.write("<BR>")

if ( time ==15)
{
document.write("Hows your day?")
}
else
{
document.write("do you know whats the time?")
}

</script>


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Copyright © 2014 by Cramerz.com.