PDA

View Full Version : unterminated string constant


Prioma
06-25-2002, 01:46 PM
this thing is totally annoying

ive checked for "" but there is none to close.

i checked in netscape it told me this....


JavaScript Error:
http://www.geocities.com/peteisbananaman/quiz.htm, line 40:

unterminated string literal.

else alert("Question 5 is incorrect/n The correct answer is Simon
................^

JavaScript Error:
http://www.geocities.com/peteisbananaman/quiz.htm, line 556:

mark is not defined.


But that speech mark is needed

the url is www.geocities.com/peteisbananaman/quiz.htm (http://www.geocities.com/peteisbananaman/quiz.htm)

ITS SOOOOOO ANNOYING

cheers if u can help

joh6nn
06-25-2002, 01:56 PM
you have two problems. your first problem, is that a line break character is \n, not /n. your second problem, is that in the alert() for question 5, you have a line break. you need to have everything all on one line. getting rid of the line break should take care of it for you.

whackaxe
06-25-2002, 01:58 PM
before anything you may want to realize that your radio boxes are named differnely so a user can select all of the answers if he likes and also you may want to replace that /n by a \n

Roelf
06-25-2002, 02:01 PM
You have a couple of linebreaks in the alert statements like
alert("bla bla
bla");

that should be fixed also the last alert statement has a few too many quotes, it should be:
alert("You scored " + score + " out of 15/n/n which is " + (100/15) * score + "%");

also without a linebreak

edit:
hehe, think we were all typing together

Prioma
06-25-2002, 07:34 PM
thanks for the advice.

still got probs tho... "expected "}" on line 102

im mesin about with it but its messed up...

advice?

:thumbsup: nice one

Prioma
06-25-2002, 07:37 PM
sorry, i think i sorted thaty prob now

new one tho...

syntax error line 100


if (document.question15.elements[1].checked)
{
score = score + 1;

else alert("Question 15 is incorrect\n The correct answer is nobody lives in Farthing Wood, it got knocked down");
alert("You scored " ' + score + ' " out of 15\n\n which is " + (100/15) * score + "%");
}

somewhere around there i think