Making a webpage from some code
First copy the talk3 code from the link below.
Open Notepad and paste in the talk3 code. Save the file as follows:
File, Save as
File name: talk3.html (the .html makes it a webpage)
Save as type: Text Documents (*.txt)
Save
Now open your webpage and check that it is working, by inputting the word "force".
Changing the code
We are now ready to try changing the code! Take care when coding; the smallest mistake can stop the code working!
Close the webpage and then Right click on its icon and choose "Open with, Notepad" to get at the code.
You can change the text that starts with "Hello. It's Grumpy again......". Close the code and open the webpage to see the result.
Can you see the code "font-size:20px"? Try changing the 20 to another quite different number.
Now, taking care, replace
if(question==="force")
with
if(question==="force" || question==="FORCE")
.
The || symbol is the JavaScript code for "OR", so we are making the computer accept either force OR FORCE. Now try inputting "force", FORCE" and "Force" in turn.
Finally, as a challenge, see if you can add a third word into the computer's memory! Take your time. Don't just guess; wait until you're sure it's right before saving the code. Test it out by inputting various words.