The Essential Guide to HTML5

(Greg DeLong) #1

CHAPTER 6


Code Explanation


document.f.score.value = String
(1+Number(document.f.score.value));


Increment the score (need to change value to number,
add 1, and then change back to text)

} Close if match true clause


else { Else


document.f.out.value = "WRONG";} Output the value WRONG


} Close else clause


else { If it wasn't a second click


makingmove = true; Check makingmove


elementinmotion = this; Save this element in the elementinmotion variable


} End else clause


} End pickelement


End script
End head
Start body tag. Set up call to init on loading.

G20 Countries and
capitals



Heading on the screen

Click on country or capital
and then click on corresponding
capital or country.


Direc tions

Paragraph

Reload for new game. Directions


Start of form

Action: <input name="out" type=
"text" value="RIGHT OR WRONG"/>


Text label and then input field
Free download pdf