Assignment 7 Solution

Script I

First, create an HTML page that prompts the user for two strings. Then create a button that will invoke a JavaScript function. The function will be scripted to search the second prompt for the first prompt. In other words, the program will search the second string entered to see whether it contains the first string entered. If the string is found, alert the user with the index position at which the string was found. If the string is not found, provide the user with an appropriate message.

Script 2

Next, create another HTML page that contains four buttons. Each button when clicked should cause an alert dialog to display a different time or date in relation to the current time. The first button is a Now button that alerts the current date and time. The second button is a Yesterday button that alerts the time and date 24 hours ago. The third button is a 10 Years Ago button that alerts the time and date 10 years ago. The fourth button is a One Week from today button that alerts the time and day one week from today.

Script 3

Now, create an HTML page that tests at least 5 Math functions. Output the results in tabular format. Indicate each Math function tested, the values passed as arguments and the result of each function.

Script 4

Finally, create an HTML page that inputs an integer code for a character and outputs the corresponding character.

Zip the files created into a zip file called and submit the zip file.

Your assignment grade will be based on correctness of JavaScript code, readability of the Javascript code, code comments and final HTML page layout.
Powered by