Click to See Complete Forum and Search --> : code that works with netscape window.location.search


jc021179
10-30-2003, 05:15 AM
I have been trying to make a 5 question quiz using javascript and html.

so far what i have got is at:
http://clubley.hopto.org

each question page consists of a question with 3 radio boxes to select an answer;0,1,2. The users selection is then posted to the browser location. the problem is under IE. the result posted is just "undefined" and under netscape my next button doesnt even work.

can u have a look and give me any suggestions you might have?

thanks in advance

Charles
10-30-2003, 05:29 AM
Since 13% of users do not use JavaScript you should be doing this server side, but as this appears to be your homework we'll let it pass.

1) It is generally best to use JavaScript as sparingly as possible. Turn those JavaScript buttons back into submit functions. The best way to pass information between pages is by using hidden form elements. This will serve you well when you go make a real, server side version. For the training wheels, JavaScript version parse the URL and assign the values to the hidden form elements when the page has loaded.

2) Your HTML is atrocious.

3) The handler names are all lower case. It's "onclick" and not "onClick".

4) Do not use the pseudo URL scheme "javascript:" in a handler. You shouldn't use it as a value for a "href" attribute either.

5) The preceding two are errors that browsers tend to forgive, but they are errors nonetheless. And browsers, even Microsoft and Mozilla, do not always forgive them.