Presentation is loading. Please wait.

Presentation is loading. Please wait.

Answer questions about assignment.. Starting JavaScript, at my site these examples are under programs and JavaScript. You can see the address for this.

Similar presentations


Presentation on theme: "Answer questions about assignment.. Starting JavaScript, at my site these examples are under programs and JavaScript. You can see the address for this."— Presentation transcript:

1 Answer questions about assignment.

2

3 Starting JavaScript, at my site these examples are under programs and JavaScript. You can see the address for this example above. To see the code, you use view and then source.

4 I used very basic html without including head and body, it would be better to include them, I wanted to simplify on the first examples. The document.write instruction does the write method on the document and writes what is in the parenthesis. This example has a literal enclosed in quotes in the parenthesis. The next line puts up an alert which is the pop up you see on the previous slide.

5

6 Notice when I took out the quotes around the literal, nothing got written. I just go the white screen.

7 This window is prompting the user to enter a number. Notice the message tht says Enter the second number, I have already gotten the first number I just did not take the picture. Also notice the 0 in the box.

8

9 The prompt asks for user input, you can see the message in quotes and then the comma and the 0 that shows in the box. The numbers that are keyed in are stored in firstnum and secondnum because the results of the prompt are assigned to those fields. Then I do a calculation and then I document.write the results. Note that the numbers I keyed in were 4 and 5.

10

11

12

13

14

15

16 The + is used to add and also to concatenate. Converting to a number assures that it will add.

17

18

19

20

21

22 Need an equal number of { and }. Originally anything that was not an * would cause it to divide. I am adding an if to fix that.

23

24

25 In explorer, there is a problem with popup boxes and prompts, a change to the security setting to medium makes things work better for these examples although obviously there are other things to consider when changing security settings.


Download ppt "Answer questions about assignment.. Starting JavaScript, at my site these examples are under programs and JavaScript. You can see the address for this."

Similar presentations


Ads by Google