Day3 - Lab Assignment
Day3 - Lab Assignment
1- In Your home Page, show prompt that asks the user to enter his name, and show text
in the browser status bar saying “Welcome UserName, have fun in my website”.
2- Display clock with current date and time in the top of the page (updated every
second), and make button that stops the clock.
3- Create a form that redirect to another page when user submit the form, and put in this
form textbox (user name) and password field (password) [textboxes must have name
attribute] and button (login). User name text has default text “Enter your user name
here”, and when user starts to write on it (get focus) remove this default text and make
it empty (make textbox empty when it gets focus only, when it contains the default
text, don't empty it if it contains any other text). After user finish writing his user
name and leaves the text box (lost focus), if the user name wasn't in correct format
(not empty string and more than 3 letters), show text next to textbox saying “user
name invalid”, and focus the user name textbox, and select all text on it, else if user
was in correct format hide the text next to user name textbox, and focus password
textbox.
4- In previous assignment, when user clicks login he will be redirected to another page
(the page given in the form action), use get method and on the other page get the user
name (from the browser URL) and write on the center of page welcome + User Name.
5- Alert the code of key pressed on a textbox, and which mouse button clicked on it.
6- Make a link that on its onClick event, creates and opens new window after 3 seconds,
and write long paragraphs on it, and make this window scrolls vertically automatically
(the scroll bar moves every second to below automatically). Also, make another link
that closes this page.
Work on this assignment and you can deliver them till next Lab:
1- Create new page named “MySlidShow.htm”. The slide show page has four links
(previous, Start SlideShow, End Slide Show, Next). When user put the mouse over an
image show this image description below it and pause the slide show if it is running,
and when the moves the mouse away hide the description and date and resume the
slide show. (Use array to store images name, and another to store images description)
[You may use one associative array, instead of 2 arrays].
Bonus assignments:
Do what you can of the following Bonus assignments:
a. Make textbox that don't accept space on it (check for key code in keypress event),
and don't accept right click on it.
b. In Assignment No.5, make countdown until the page opened (3….2…1) next to
open links.
c. Make the home page when unloaded [put link to another page, don't close the page
from the browser] show alert saying “Thanks for Visiting My Website” (search for
the suitable event, and handle the event using JS, not in HTML tags).
d. Make text on the status bar (on assignment 1) moves to the end of status bar, and
return again.
e. Disable right click on your photo gallery page to prevent anyone from saving your
pictures.