Download presentation
Presentation is loading. Please wait.
Published byRoderick Russell Modified over 8 years ago
1
Answer questions about assignment.
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.
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.
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.
16
The + is used to add and also to concatenate. Converting to a number assures that it will add.
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.
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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.