Jack27
02-18-2009, 04:25 PM
I am having trouble working this out! I have been working on this forever and it is really difficult for me. I am new to Java Script and it's annoying! I would like anyone if they can to show me how to do this problem and explain the steps it takes to do that. Thanks I would really appreciate it. They want this written in two basic text documents as two separate files, one as an html and the other as js, which both go together, I don't know. Please help! Thanks:
1. Create a web page that looks like the following:
Choose a Movie: (this should be a drop down box with movie titles)
Name: (this should be a text box)
(right here is three radio buttions: Child, Adult, and Senior)
How many: (another text box) (followed by a button called Purchase)
Build things in pieces. Start with the drop-down box. Then add some options. Then add the text field and then add the button.
2. Add an event handler to the button (see Button Click Event Handler in the slides).
3. Start by having the event handler make a pop up box appear that says the movie name. In other words, when you click the button, a pop up box appears with the selected movie name.
4. Change the movie name and click the button. Does the pop up box say the new movie name?
5. Now have the pop up box also show the customer's name. Change the customer's name and verify that the message is different in the pop up box.
6. Now format the message. It should say: <customer name>, you just purchased a ticket for <movie name>
7. In the HTML, add an empty paragraph (<p></p>) below the text field and button.
8. The event handler should change the <p>'s innerHTML to be the text you put in the pop up box (remember to give the <p> an id). Look at the examples in the slides to see how to change innerHTML.
9. Remove the pop up box from the event handler. It should no longer appear.
Make sure that you can only click on one radio button at a time. Add <label> like in the slides, so that you can click on the words next to the radio button, instead of having to click exactly on the circle.
Remember: Build things in pieces!
10. The prices are as follows: child ($5), adult ($10), senior ($7). When the "Purchase" button is clicked, the price will be shown to the user. See below:
Start out by having the Purchase button pop up a box saying which radio button was pressed. There are two ways to solve this: (a) you can use 3 different if statements to check which radio button is activated (use the "checked" attribute) or (b) you can use a for loop that loops through the radio buttons trying to find which one is checked.
11. Now use the fact that you know which radio button is activated to set the price. If you decided to do method (b), you should store the price in the value attribute of the radio buttons, that way, when you find that a radio button is checked, then you know the price is in document.getElementById("...").value
12. Now make it so that the Purchase button event handler will also take into account the number in the "How many" box. You'll have to save your message in a variable and then continually add it to another variable.
1. Create a web page that looks like the following:
Choose a Movie: (this should be a drop down box with movie titles)
Name: (this should be a text box)
(right here is three radio buttions: Child, Adult, and Senior)
How many: (another text box) (followed by a button called Purchase)
Build things in pieces. Start with the drop-down box. Then add some options. Then add the text field and then add the button.
2. Add an event handler to the button (see Button Click Event Handler in the slides).
3. Start by having the event handler make a pop up box appear that says the movie name. In other words, when you click the button, a pop up box appears with the selected movie name.
4. Change the movie name and click the button. Does the pop up box say the new movie name?
5. Now have the pop up box also show the customer's name. Change the customer's name and verify that the message is different in the pop up box.
6. Now format the message. It should say: <customer name>, you just purchased a ticket for <movie name>
7. In the HTML, add an empty paragraph (<p></p>) below the text field and button.
8. The event handler should change the <p>'s innerHTML to be the text you put in the pop up box (remember to give the <p> an id). Look at the examples in the slides to see how to change innerHTML.
9. Remove the pop up box from the event handler. It should no longer appear.
Make sure that you can only click on one radio button at a time. Add <label> like in the slides, so that you can click on the words next to the radio button, instead of having to click exactly on the circle.
Remember: Build things in pieces!
10. The prices are as follows: child ($5), adult ($10), senior ($7). When the "Purchase" button is clicked, the price will be shown to the user. See below:
Start out by having the Purchase button pop up a box saying which radio button was pressed. There are two ways to solve this: (a) you can use 3 different if statements to check which radio button is activated (use the "checked" attribute) or (b) you can use a for loop that loops through the radio buttons trying to find which one is checked.
11. Now use the fact that you know which radio button is activated to set the price. If you decided to do method (b), you should store the price in the value attribute of the radio buttons, that way, when you find that a radio button is checked, then you know the price is in document.getElementById("...").value
12. Now make it so that the Purchase button event handler will also take into account the number in the "How many" box. You'll have to save your message in a variable and then continually add it to another variable.