04 comments variables n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Intro to Programming Using JavaScript PowerPoint Presentation
Download Presentation
Intro to Programming Using JavaScript

play fullscreen
1 / 3

Intro to Programming Using JavaScript

140 Views Download Presentation
Download Presentation

Intro to Programming Using JavaScript

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. 04 Comments & Variables Intro to ProgrammingUsing JavaScript

  2. Exercises Start with this: <html> <head> <title>JavaScript Homework Ch 4</title> <script language="JavaScript"> function Main() { /* Enter your JavaScript statements here */ } </script> </head> <body> <input type="button" onclick="Main();" value="Click me!" id="hello1" /> </body> </html>

  3. Exercises 1 Write some JavaScript code that prompts a user for the city and the state that he lives in (using 2 separate variables). Then create a 3rd variable that will contain something similar to “I hear it's beautiful in Williamsville, Illinois this time of year!” Then display the contents of that field in an alert box. Also, be sure to add comments, explaining what each variable is for. 2 Write a JavaScript program that asks for a name, street address, city, state, and zip and stores each in a separate variable. Also add a new variable, called newLine and assign it the string “<br />”. Then display the information directly on the web page in 3 lines, like it would appear on an envelope. The part of your program that writes to the web page should only use variables, and no string literals. Also add a multi-line comment that explains what the function Main is doing.