PDA

View Full Version : Missing ; before statement [RESOLVED]



jussa
Sep 14th, 2007, 07:33 AM
hey all,

In Firefox's web developer javascript error console, i get the following error:
missing ; before statement

the line at fault refers to this, and code in red bold denotes what is what throwing spanner into the works...


<img src="images/global/arrow_down.jpg" alt="" style="cursor:pointer" id="NaturalAccDownArrow' + rowNumber + '" onclick="selectNaturalAccountCode('', ' + rowNumber + ', false);"/>

and it points to the first comma in the parenthesis of that function...

removing the onclick code means that works fine... any help would be fantastic.

Cheers

felgall
Sep 14th, 2007, 07:57 AM
Where you set the id to:

NaturalAccDownArrow' + rowNumber + '

what is the end of that supposed to represent? Quotes in ids are not valid and neither are spaces and plus signs.

That could be messing up the parser so that it is totally lost by the time it gets to where it reports the error.

jussa
Sep 14th, 2007, 08:21 AM
its meant to output:

say rowNumber = 4

id="NaturalAccDownArrow4"...

oh wait. need to escape single quote.

fixed to :

onclick="selectNaturalAccountCode(\'\', ' + rowNumber + ', false);"