Assignment 3 Javascript 2
Assignment 3 Javascript 2
Write a script that asks the user to enter a number through a prompt dialog. You have to
test the number if it is even or odd number and display the result in an alert dialog. Ask
the user if he wants to continue in entering the numbers. If yes then you have to repeat
the above steps, if no then the script ends.
Write a script that contains a function getStatus() that you can pass a grade as a parameter
and have it display based on the following:
A is a grade of 90 or greater
B is a grade of 80 or greater, but less than 90
C is a grade of 70 or greater, but less than 80
F is any grade below 70
Demonstrate the function by printing out the grade for five students. One example of one
student could be:
document.write("Mary - ") + getStatus(94) + document.write("<BR>")
Place a single button on a page that could be used as an ON/OFF switch. Design this
button so that the button is labeled "ON". When you click on the button its label should
change to "OFF". Clicking on it again should change it back to "ON" and so on.
Part 4: Loops
Write a script to print the numbers 1 through 20. Your results should be printed on 4 lines
with 5 numbers on each line. Be sure to put a space between the numbers that are on the
line. This will require a loop inside of a loop. I recommend that you get one loop working
and then add the second.