Interactivity — JavaScript

JavaScript is a 'client' side scripting language. That means that lines of 'code' are read by the user's browser as the page is received from the web server and then executed at the appropriate time. Many parts of this site use JavaScript, usually running quietly in the 'background', so that such things as image rollovers and sounds are loaded and executed. The menu on the left is driven by JavaScript and the 'colour changing' feature on the Text page is manipulated using JavaScript.

As well as allowing a web designer to influence the behaviour of the page it is also possible for JavaScript to be triggered by the user. Here is a simple general knowledge quiz that is evaluated and scored by javascript:

General Knowledge Quiz

1) What is the difference between a jungle and a rain forest?
a) No difference. Simply two different ways in referring to the same thing.
b) A jungle in general receives less rain than a rain forest.
c) A jungle refers to the thickest area of a rain forest
d) A jungle and a rain forest each contain their own group of distinct plants and animals.

2) What is the world's most common religion?
a) Christianity
b) Buddhism
c) Hinduism
d) Muslim

3) Which city ranks as the world's most populous city (2002)?
a) New York (US)
b) Mexico City (Mexico)
c) Tokyo (Japan)
d) Shanghai (China)

4) What is the second largest country (in size) in the world?
a) USA
b) China
c) Canada
d) Russia

5) As of January 2003, how much is Microsoft Chairman Bill Gates's net worth?
a) 10 million US
b) 10 billion US
c) 35 billion US
d) 50 billion US

6) Which country below is not one of the members of the UN security council (Jan 2003)?
a) USA
b) China
c) Germany
d) France

7) The longest river in the world is:
a) Amazon (Brazil)
b) Nile (Egypt)
c) Yangtze (China)
d) Congo (Zaire)

8) Which software firm is the second largest in the world, after Microsoft?
a) Netscape
b) Oracle
c) Lotus
d) Norton

9) What's the world's most widely spoken language?
a) English
b) Spanish
c) Mandarin
d) French

10) Which continent is host to the most countries in the world?
a) Asia
b) Africa
c) Europe

Quiz script provided by
JavaScriptKit.com