Sunday, September 28, 2014

Lab 4


In lab 4, we learned how to create an information form using JavaScript and we had to create a prompt box to show the results. Mrs. Ramirez helped us start off lab 4 by giving us the code. I added favorite activity, year you plan to get a car, and favorite food to my code. For this lab, we had to write JavaScript code inside our html document. In order to give someone their age, we had to use the code 'You are' +  '  '  (document.informationform.data.value- document.informationform.birthday.value) + ' ' + 'yearsold'.

The "-" sign is used to minus the current year the person filled in and their  year of birth to get their current age.  After the person filled in the  information, a prompt box pops up showing their first/last name, birthday, current year, favorite activity, in how many years they will get a car, and their favorite food. I can use this skill in the future to create an information form for a user to fill out.


Lab 3: Alert Box


                
       


                                                   
                                                 


In lab 3, we learned how to create a alert box using JavaScript. We had to create three level 3 questions about what we learned about JavaScript so far. When, someone clicks on the question, a alert box will pop up with the answer and the user have to click "ok" to continue. We had to attract our JavaScript coding to our HTML document. 

We created the alert box by creating the button id (clicker1, clicker2, clicker3). We had to change the names of the buttons also (oButton, oButton2, oButton3) and the function name (behave, panda, bear). For example, for question 1 which is 'clicker1' and the function name is "behave". When, a person clicks on question 1, the function "behave" tells what to do when the button is clicked. The function "behave" pops up an alert box that tells the answer to the question. I can use this skill in the future to create alert boxes to get information to the user and they can click "ok" to continue.

Lab 2




                                                                                      In lab 2, we learned how to 
 write our name in JavaScript. We used the code <script> x= "IT'S MY NAME...." document.write ("Akampreet" +x) </script> in this lab. But, if you test the code on a brower, it would come out as "Akampreet ITS'S MY NAME." The "x" in the code represents a variable and after the "=", we write what we want to write in the HTML content using "". First, we  wrote "Hello World!" then, we 
                                                                                    wrote our name in the bottom of it.

I can use this code in the future to write JavaScript inside my html document using <script></script>. In addition, I know how to use variables in my code such as "x" or "=".

Thursday, September 18, 2014

Lab 1 - My First JavaScript





In lab 1, we had to create our first JavaScript. We learned how to change the content of an HTML element using JavaScript by creating a button that says "Click Me!" We used the code <button type= "button" onclick= "myFunction()"> Click Me!</button> to create a button. Below the button, it says "This is a demonstration" but when someone clicks on the button, it changes to "Hello JavaScript."                                                                         
 I can use this skill in my future labs to create buttons such as home button, labs button, etc.