60 likes | 215 Views
Reminder. Lab 6, due Wed, 10pm Lab 7/8 both due next Mon (May 9). Tips on Lab 7. To make the image of hands in the center, add the following CSS code between the <style> tags (You need a pair of p tags around the img tag to make it work): p {text-align:center;}
E N D
Reminder • Lab 6, due Wed, 10pm • Lab 7/8 both due next Mon (May 9)
Tips on Lab 7 • To make the image of hands in the center, add the following CSS code between the <style> tags (You need a pair of p tags around the img tag to make it work): p {text-align:center;} • If Error Console thinks this is wrong: “display( ‘ let” + letter + “.jpg ‘)” Use the following instead: “display( ' let” + letter + “.jpg ' )” ' is the ASCII code for single quote
Tips on Lab 7 (cont.) • In Part 2 of Lab 7, when you call spell() with your name, use CAPITALIZED letters and don’t forget “*”. For example, mine will be: onclick="spell(‘YUAN*’, 500)"
Tips on Lab 8 • Please finish Week 6 reading before you do this lab. • Figure out what goes where. The declaration of variables and functions should go between <script></script> at the head section. The JS codes for onclick event, such as calling a function and changing the value of a variable, go to onclick=“…” inside the button input tag.
Tips on Lab 8 (cont.) • There are two typical ways to assign the value of the text box to the variable text. Assume the input tag for the text box is <input type=“text” name=“boxName” id=“boxID” value=“” /> • Use name(see textbook P.592) text = document.forms[0].boxName.value; • Use id text = document.getElementById(“boxID").value;
Tips on Lab 8 (cont.) • Sketch of the new spell function (overwrite the old one) function spell (){ varoneLet; text = text.toUpperCase(); for(var j=0; j<text.length; i++){ oneLet = text.slice(j, j+1) ; if (oneLet==“J”){ //show the letter “J” with four images; use elapsed + 250 as time } else if(oneLet==“Z”){ //show the letter “Z” with four images; use elapsed + 250 as time } else{ //show oneLet; use elapsed + 250 as time } //end of the if-else statement } //end of the for loop //show the image of folded hands; use elapsed + 1000 as time } //end of the spell function