English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm not very good with javascript yet i know some things due to some knowledge in actionscript. I'm tring to make an impossible quiz and it seems quite impossible to make. when veiwing the pade it says there is a script error. Can someone please find it for me please.








Test your knowledge on gadgets.



What is 1+1?

a) 2

b)11

2007-04-25 05:20:53 · 3 answers · asked by god0fgod 5 in Computers & Internet Programming & Design

What does AAC stand for?

a) Advanced Audio Coding.

b) Army Air Corps.

what is the square root of 4

a) 2

b) -2





2007-04-25 05:21:09 · update #1

var yourAns = [];
function Engine(question, answer) {
yourAns[question] = answer;
}
function Score() {
if (yourAns[1] == "a") {
alert('WTF ..');
} else {
alert("WTR...");
}

i found this doesn't work. Stupid of me not to use two equal signs.

2007-04-25 05:52:57 · update #2

3 answers

1) you need apostrophe or quote around string literals
2) you need to define yourAns as a global variable
3) = is assignment in javascript, == is the equality test; your if statement is trying to assign the value of the (non-existant) variable named "a" to the first element of the (non-existant) array named "yourAns"

var yourAns = [];
function Engine(question, answer) {
yourAns[question] = answer;
}
function Score() {
if (yourAns[1] == "a") {
alert('WTF ..');
} else {
alert("WTR...");
}

2007-04-25 05:35:56 · answer #1 · answered by talis 3 · 0 0

There are several problems with the script. I won't do you the disservice of pointing them out. To learn, your best bet is to learn debugging. To debug: one way is to use Internet Explorer, a good trapper. Start by commenting out bunches of the javascript - that is, place // in front of the lines of code. Then, gradually, uncomment lines of code, until you find the lines of code that produce errors. This may take iterations. You may find that, when you correct one error, you may find others...

2007-04-25 05:39:09 · answer #2 · answered by fjpoblam 7 · 0 0

ok, first your interest fee. once you multiply how lots funds would desire to be interior the account after at the same time with interior the interest, you will desire to characteristic a million to the fee. So, $one hundred with a 10% fee would desire to be: one hundred * (a million + 0.10) = $one hundred ten.00 on the 2nd, you're forgetting with a view to characteristic the only to the fee. additionally, given the project definition, i don't have self belief this is straightforward to assume the money will run out in 12 years, so as a substitute of a for loop, create a whilst loop and have it run till the money reaches 0. moneyLeft = amountInherit; year = a million; whilst(moneyLeft != 0) { moneyLeft += moneyLeft * (interestRate + a million); if(amountUsed > moneyLeft) amountUsed = moneyLeft; moneyLeft -= amountUsed; year++; checklist.write("trtd" + year + "td"); checklist.write("td" + amountUsed + "td"); checklist.write("td" + moneyLeft + "tdtr"); }

2016-12-16 15:06:39 · answer #3 · answered by ? 4 · 0 0

fedest.com, questions and answers