Javascript Quiz Tutorial



You've probably come across javascript quizes on the internet some point in your life (perhaps you've taken one here?) and you've probably wondered how you make them. Well, you've come to the right spot.

Before beginning the tutorial you should probably right out your quiz and have the answers all planned out. It makes coding it much easier!

Step # 1

Copy and paste this code into a new page on your site. This will be your quiz page. You can call this page anything.

Step # 2

You don't want TITLE OF QUIZ as your title in the title bar, so find the title tag and replace TITLE OF QUIZ with your title.



Step # 3

Now go down to where it says SCRIPT LANGUAGE JAVASCRIPT.



Where it says var RESULT1, replace it with a short name of your result. (Ex. Your quiz is what colour are you, you would put blue.) This will be the name of the page where your result will be displayed. Don't put your file extension such as ".html" because there's a place later on in the code that adds this for you. The name of your result can't have any spaces or symbols other than letters and numbers. So, minnie mouse or m!nn!emouse wouldn't be good, but minniemouse is fine.
Do the same for RESULT2, RESULT3 and RESULT4.

Step # 4

Find the part in the coding that looks like this image below.

Site hosted by Angelfire.com: Build your free website today!