Lecture # 14 Javascript: Loops, Branching and Putting it all together.

Slides:



Advertisements
Similar presentations
We Can Read About Mixing Colors
Advertisements

COLORING WITH NUMBERS. NumbersNumbers NumbersNumbers
Orange Boat 3Purple Boat 4Red Boat 5Yellow Boat 6Green Boat 2Blue Boat 1.
© red ©
Primary/ Secondary Colors
The Color Wheel Miss Sawyer Kindergarten Begin Lesson Plan.
Skip Counting Counting by 2, 5, and 10.
NAME MANDALAS E. Lyon Lyon 1. Review – Last Class 9/8/2014  We folded our paper to create a lot of overlapping triangles  Then we wrote our.
Mrs. Smith’s 7th Grade Reading Blue Class Mrs. Smith’s 7th Grade Reading Blue Class Mrs. Smith’s 7th Grade Reading Blue Class.
What people are wearing T-shirtshirtjacket skirt sweatshirt trausersdress blouse.
The Color Wheel Claire Heider The Primary Colors.
Web Design ATBs. ATB #1 List headings and size ATB #2 Define HTML.
Editing Clipart On the following slides, make the requested changes only to the large clipart. The small clipart is for reference. BEFORE AFTER Right click.
LessonLesson 15 Shi Ping. Pink, pink, I like pink. Blue, blue, I like blue. Green, green, I like green. Yellow, yellow, I like yellow. Purple, purple,
If you say 8 color the ones in your picture purple. If you say 9 color the ones in your picture blue.
Color Mixing 101.
How many items of clothing can you remember? Remember the color for a bonus point!
Unit 5 My clothes Part A Let’s learn Let’s do 衣服.
FRACTIONS & SHAPES BY:. How many of these are colored red? * out of *.
= 5 = 2 = 4 = 3 How could I make 13 from these shapes? How could I make 19 from these shapes? STARTER.
LEVEL 1 Lesson #1. Lesson #1: School & Bus Questions Here are the questions we will be asking in this conversation: Yes/No Colors Numbers.
NOTE: In order to play this game, it must be viewed in slide show (F5) Red Orange Yellow Green Blue Purple Pink White Gray Brown Black Miss Jackie—Bridgeport.
Unit 5 My clothes Part A Let’s learn Let’s do. dress red dress.
Part A Let’s learn Unit 5 My clothes.
Color Distribution A block BrownYellowOrangeRedGreenBlue GreenYellowOrangeRedPurple M&M Skittles.
Controls for Choices. Let’s look at a couple of new controls: option buttons and check boxes These controls are designed to be used when you want the.
Art Class for 1 st Grade with Ms. Jenzano Click the Paint Brush to Move on.
My Clothes Vocabulary Listen and Repeat Teacher: Haifaa Mesmari.
“THE ONLY THING THAT LOOKS GOOD ON ME IS YOU” (By Brian Adams) Adjectives.
Scientific Notation. = 5.4 =3.47 Write the following in standard form A 1.8 X 10⁴ B 3.47 X 10⁷ C 4.3 X 10⁰ D 5.4 X 10⁻⁴ E 5 X 10⁻⁶ F (6 X 10⁴) (7 X 10⁵)
青龙湖中心小学 邵 丽 2011 年 4 月. What clothes did I buy? My clothes shopping list shirt T-shirt shoes skirt gloves belt tie socks hat jeans pants vest coat cap.
What are they wearing?. She is wearing a _______ and ______ and _____ dress and a pair of _______ sandals. purple yellow blue.
Gabriel palomino 4 th period. A graph gathers up information such as favorite shoes, favorite colors ect. voted- what they vote for Dislike- didn’t pick.
By Lucy. My favorite video game is Minecraft MY FAVORITE VIDEO GAME IS.
Period II Unit 7 How much are these socks?. Let’s chant: My shirt is red. My jacket is blue. My dress is old. My sweater is new. Socks, my socks are white.
Unit 5 My clothes A. Let’s learn Let’s do It is beautiful and colorful. It has seven colors. They are red yellow pink green purple orange and blue. rainbowrainbow.
What is your favorite color?
Ask and Draw Game.
COLORS.
Unit 6 Fashion Welcome to the unit.
Name: Spelling: 3 x each 1-5 Math: Lesson 6 Problem Set 1-8
Red hat, red hat, what do you see? I see a green scarf looking at me.
What clothes do you like?
Lyon Name Mandalas E. Lyon
FROM OUTLINE TO ESSAY.
Skip Counting Counting by 2, 5, and 10.
Colors.
Colors/Color Words.
Follow Directions with Colors and Shapes
Unit 2 Colours and Clothes
Name: _______________________________
Skip Counting Counting by 2, 5, and 10.
Average Number of Photons
Unit 6 New school uniforms
Unit 2 Colours and Clothes
Be sure to speak to your class advisor for information!
Can I color yellow?. Can I color yellow?
Blue Boat 1 Green Boat 2 Orange Boat 3 Purple Boat 4 Red Boat 5
What Color is it?.
Student Representation Activity
Destiny.
Going to See Santa.
FROM OUTLINE TO ESSAY.
Multiplying 2-digit by 1-digit numbers
Working with ‘checked’ items Checkboxes and Radio buttons
Going to See Santa.
FROM OUTLINE TO ESSAY.
Probability Word Problems
Color Box Button - Gray Type : object Type : object Type : object
Let’s Learn the Basic Colors
Presentation transcript:

Lecture # 14 Javascript: Loops, Branching and Putting it all together

JavaScript Putting it all together

Step 1 - Background and image snowflake.gif Santa.jpg

Step 1 - Background and image Wishes for Santa Wishes for Santa

Step 2 - Check boxes

Wishes for Santa Wishes for Santa What do you like? Clothes Toys CDs

Step 3 - Radio buttons

Step 3 - Radio Buttons Wishes for Santa Wishes for Santa What do you like? Clothes Toys CDs What is your neck size?

Step 4 - Each on a line

What is your neck size?

Step 5 - Choices in table

Shirts Shoes CDs Microwave Popcorn Pants Tie Video games Trip to Paris

Step 6 - Another table

What is your neck size? What is your favorite color? Red Blue Green Yellow Purple Step 6 - Another table

Step 7 - Naughty or Nice

Have you been Naughty? Nice? What do you like?

Step 8 - Button and wish list

Yellow Purple

Step 9 - action on the button

<input type="button" value="Make your Wish" onClick="makeWish();"> <textarea name="theWish" rows=5 cols=40>

Step 9 - action on the button Wishes for Santa function makeWish() { alert("makeWish"); }

Step 10

function makeChoices() {return "the choices"; } function neckSize() {return "the neckSize"; } function favColor() {return "the favColor"; } function makeWish() { if (document.wishes.NorN[0].checked) {document.wishes.theWish.value="You were Naughty"; } else {document.wishes.theWish.value= makeChoices()+neckSize()+favColor(); } Step 10

Step 11 List of Wishes

function makeChoices() { rslt=""; if (document.wishes.shirts.checked) { rslt = rslt + "Shirts" + "\n"; } if (document.wishes.shoes.checked) { rslt = rslt + "Shoes" + "\n"; } if (document.wishes.cds.checked) { rslt = rslt + "CDs" + "\n"; } if (document.wishes.microwave.checked) { rslt = rslt + "Microwave" + "\n"; } if (document.wishes.popcorn.checked) { rslt = rslt + "Popcorn" + "\n"; } // code omitted for brevity return rslt+"\n"; } Step 11

Step 12 – Neck size and Favorite Color

Step 12 function neckSize() { size = ""; if (document.wishes.neck[0].checked) { size = "15"; } else if (document.wishes.neck[1].checked) { size = "16"; } else if (document.wishes.neck[2].checked) { size = "17"; } else if (document.wishes.neck[3].checked) { size = "18"; } return "Neck size = " + size + "\n"; }

Step 12 function favColor() { color = ""; if (document.wishes.color[0].checked) { color = "Red"; } else if (document.wishes.color[1].checked) { color = "Blue"; } else if (document.wishes.color[2].checked) { color = "Green"; } else if (document.wishes.color[3].checked) { color = "Yellow"; } else if (document.wishes.color[4].checked) { color = "Purple"; } return "Color = " + color + "\n"; }

Big lessons Take it one piece at a time Make sure each piece works before moving on