mercredi 22 avril 2015

Javascript If statements

We are trying to print the people with birthdays (on the actual date) using javascript arrays to store the information.

We have three arrays, one to store the day, the month, and the person.

so here is what we have now:

      <!DOCTYPE html>
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="css/main.css">
    <!--
        Look Into Connectors
        28 JANUARY 2015
        Assignment 1

        Author: 
        Date: 
        This is the index/ homepage of the website. It is the main page that a user should land on.

        Filename: webpage
        supporting files: 
    -->
         <title>A Look Into IT</title>
    </head>
    <meta charset="UTF-8">
    <meta name="description" content="This is a website that offers free information on IT">
    <body>

    <script type="text/javascript">
    <!--
    var bmonth = ["4","4","4","4", "4", "4", "4"]
    var bday = ["8","6","27","22", "23", "23", "9"]
    var person = ["Jesse", "john","billy" , " Buddy Dyer", "John Morgan", "Will Smith", "Jonny"]
    var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    document.write(month + "/" + day + "/" + year)
    for(i=0; i<=6; i++){
      if (month = bmonth[i]){
        if(day = bday[i]){
            document.write(person[i])

              }
       }else{
      document.write("There are no birthdays today")
}
    }
    //-->
    </script>





        </body>
    </html>

here is the output: 4/22/2015JessejohnbillBuddyDyerJohnMorganWillSmithjonny

it just prints all of the array information.

Aucun commentaire:

Enregistrer un commentaire