Keyboard Input
Click here for larger version!
|
ASSIGNMENT:
First of all try typing some words into this applet and then find out what
happens when you press the backspace, escape, or enter keys. Inspect the code
carefully to see how all this works.
Alter the code as follows:
- Pressing the ENTER key changes the color of the background. Have your
script cycle between at least five colors for the background.
- Once the length of the input string reaches 20 characters have it
automatically clear.
- Pressing the ESCAPE key changes the message to OUT TO LUNCH
- Pressing the BACKSPACE key changes the input to all lowercase. HINT: var
res = str.toLowerCase();
|