Practice Problems:

These problems are intended to clarify some of the basic concepts related to access to few of the controls. Note that the HTML code with embedded javascript (and extension .html) can be stored and opened from your C: drive (client). You may also store and open from the server. If you assign asp extension it MUST be opened from the server. Any code containing ASP must be opened from the server. Justify your answer if any of the question or a part appear not solvable.

Similar problems are solved in the JavaScript practice problems 1 and 2. You should solve and have clear understanding of all problems in JavaScript practice problems 1 and 2 posted earlier.

1: Working with Radio Buttons Extracting Highlighted Radio <a href="/tags/Button_(computing)/" rel="tag">Button</a>


Select the criteria for which you want the points in COMS463:

Project
Assignment
Midterm
Final




Select the criteria for which you want the points in COMS462:

Programming
Lab Works
Quiz
Exam1
Final



HTML Question: a. Draw the screen output of the above HTML code.

JavaScript Questions: (Note that JavaScript uses index 0 for the first button) a. print on an alert the following when the first form is submitted: - number of radio buttons included in each form. - The value of the 4th radio in the first form and the value of 3rd radio in the second form (whether or not selected) When the alert window disappears, following should happen: - . assign the value of the selected radio button in the first form to a variable named ‘allocatedPoint1’ and then print the value of ‘allocatedPoint1’ on the screen followed after a message ‘In COMS463 the allocated point for ‘ . b. print on an alert window the following when the second form is submitted: - number of radio buttons included in each form. - The value of the 2nd radio in the first form and the value of 1st radio in the second form (whether or not selected) When the alert window disappears, the following should happen:

1 - . assign the value of the selected radio button in the second form to a variable named ‘allocatedPoint2’ and then print the value of ‘allocatedPoint2’ on the screen followed after a message ‘In COMS462 the allocated point for ‘ c. print on screen the values of all radios in each form and the values of selected radios in each form with appropriate messages when the 3rd form is submitted. ASP Questions: (Assume that at least one radio is selected) a. print on the screen the count and value of the relevant radio button selected when a form (first or second) is submitted. Then store value of the selected radio in one cookie called ‘pointfortask1’ for the first form and ‘pointfortask2’ for the second form. The cookie ‘pointfortask1’ should remain stored for 7 days. The cookie ‘pointfortask2’ should get deleted after closing the session. b. check the radio selections if the user has submitted the second form with ‘Quiz’ selected. If yes, store 25 in a session variable called ‘Quiz’. c. test and report the existence of the above cookies when you start the session next time. d. print on the screen the values of radio buttons selected in each of the forms when the third form is submitted.

2: Working with Selections for single choices Change the HTML code in practice problem 1 so that the user is able to make a selection of the choices from a list instead of radio buttons and get the same functionality. Complete all the exercises listed in practice problem 1. Test your code on a computer.

3: Working with Extracting Highlighted Radio Button


Select the criteria for which you want the points in COMS463:

Project
Assignment
Midterm
Final




Select the criteria for which you want the points in COMS462:

Programming
Lab Works
Quiz
Exam1
Final



HTML Question: a. Draw the screen output of the above HTML code.

JavaScript Questions: (The events take place after clicking on the relevant or any button) a. print on an alert window the following when the first form is submitted:

2 - number of checkboxes included in each form. - The value of the 3rd checkbox in the first form and the value of 4th checkbox in the second form (whether or not selected) When the alert window disappears, following should happen: - display on the screen (not alert box) the values of selected checkboxes each on different lines followed by the message ‘In COMS463 the allocated point for ‘. b. print on an alert window the following when the second form is submitted: - number of checkboxes included in each form. - The value of the 2nd checkbox in the first form and the value of 1st checkbox in the second form (whether or not selected) When the alert window disappears, the following should happen: - display on the screen (not alert box) the values of selected checkboxes each on different lines followed by the message ‘In COMS462 the allocated point for ‘. c. print on screen the count and values of all check boxes in each form along with total count and the values of only selected check boxes in each form with appropriate messages when the 3rd form is submitted.

ASP Questions: (Assume that at least one radio is selected) a. print on the screen the count and values of the relevant checkboxes selected when a form (first or second) is submitted. Then store value of the selected checkboxes in one cookie called ‘pointfortask1’ for the first form and ‘pointfortask2’ for the second form. The cookie ‘pointfortask1’ should remain stored for 7 days. The cookie ‘pointfortask2’ should get deleted after closing the session. b. check the checkbox selections if the user has submitted the second form with ‘Quiz’ selected. If yes, store 25 in a session variable called ‘Quiz’. c. test and report the existence of the above cookies when you start the session next time. d. display the value of the selected check boxes each in one when the a form is submitted. (Note that the number of text boxes will equal to the number of check boxes selected.) e. print on the screen the values of checkboxes selected in each of the forms when the third form is submitted. f. print on the screen the value of the second and the last checkbox selected.

4: Working with Selections for multiple choices Change the HTML code in practice problem 2 so that the user is able to make a selection of the choices from a list (multiple at a time) instead of checkboxes and get the same functionality. Complete all the exercises listed in practice problem 3.

5: Working with Text boxes a. Write HTML code to display three text boxes on a screen. In the first text (no 1) box you may enter a number 1, 2 or 3 followed by space(s) and then any sentence. After clicking on the button, the sentence (without the numbers) should be displayed in the appropriate text box (1, 2 or 3) identified by the leading number entered in the first text box. If the leading number in the given range is missing in the first text box, then an error message is displayed asking to follow the specification.

i. Write a JavaScript function to achieve the above functionality. ii. Write ASP code to achieve the above functionality.

3