W3101: Scripting Languages: Javascript -- HW4
This homework is due on Monday, Apr 20.
Please add "yourname" before each of HW4-1.html,
HW4-2.html for the two problems.
Submit a zipped version of the files in Courseworks.
- Implement the name and password cookie that we discussed
in the class. That is, implement it as follows:
- Have two fields, one "login" (text) field and a "password"
field.
- Enter the login and password fields with valid (non null,
non blank) values. Have a submit button that sets a cookie
with the login value, and another cookie with an
"encrypted" password. You can use as simple or as complex
an encryption function as you can. Please make sure you
can not only encrypt but decrypt also the password.
- When the cookie is not set, enter valid login and password
values. Set the expiration time of the cookie to 1 year
from the time it is set. Encrypt the cookie with your
encryption function and show it in an alert box just
before you set it.
- If the cookie is set, read the values for login and password
from cookie, decrypt the password and show the decrypted
password in an alert box. Fill in the values of the login
and password fields from those you read from the cookie.
- If the cookie is already set, display the time of the last
visit of the web page to the user in an alert box.
- Have a button called "Delete cookie", that when clicked
would delete the cookie. Note, all you need to do to
reset a cookie is to set the expiration time to the
current time and set the cookie.
- Implement a stop watch in Javascript, accurate to a hundreth
of a second. It should show the hour, minute, second values
and also the hundreth part of a second. You should update it
once every 10 milliseconds.
Have a button called "Start" that starts the stop watch.
Change it to "Stop" as soon as the stop watch is running.
When you click it, stop the stop watch and change the button
again to "Start".
risukapalli
Last modified: Mon Apr 13 01:05:52 EDT 2009