The following steps cover an example of client-side JavaScript from Ch. 2 of our textbook:
- Download the Ch. 2 Quiz Ninja files to the 111 folder on your computer as follows:
a) Download index.htm to 111/p2/quiz-ninja.html. Do not name the file index.html.
b) Download scripts.js to 111/p2/js/scripts.js.
c) Download styles.css to 111/p2/css/styles.css. - Open your 111 folder in a text editor (Sublime, Atom or Brackets).
- Preview the web app in Chrome.
- Use CyberDuck to upload all three files to folders with the same name on the uoregon.edu server. Do not upload a file named index.html; the correct file name is quiz-ninja.html.
- In Chrome, open the 111/p2/quiz-ninja.html web page that is on the uoregon.edu server, to make sure that it works the same as when you preview the web page on your computer.
- Open the JavaScript Primer in Chrome. Study the syntax of the if and if-else statements. See also pp. 69-72 in Ch. 3 of our textbook.
- Add an if statement to scripts.js to alert the user when a correct answer is given. Test it by previewing quiz-ninja.html in Chrome.
- Change the if to an if-else that alerts the user when a correct answer is given, and also alerts the user when an incorrect answer is given.
Test it by previewing quiz-ninja.html in Chrome. - After the previous step is correct and complete, use CyberDuck to upload the final version of quiz-ninja.html and scripts.js to the server. This will be a Project 2 deliverable.
Recent Comments