1 / 3

Intro to Programming Using JavaScript

04 Comments & Variables. Intro to Programming Using JavaScript. Exercises. Start with this: <html> <head> <title>JavaScript Homework Ch 4</title> <script language="JavaScript"> function Main() { /* Enter your JavaScript statements here */ } </script>

baxter
Télécharger la présentation

Intro to Programming Using JavaScript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

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.

More Related