PDA

View Full Version : Quick error help needed



kevinv1990
27 Sep 2010, 12:51 AM
Hello everyone,

I am making an webapp and I get this error (viewed with firebug, because in safari I don't know how to view it).


missing ; before statement
var activeItems[];\nindex.js (line 6)

missing ; before statement
var dockedItems[0].setTitle(button.text);\nhome.js (line 29)



To check the errors use this location:
http://webservices.hireserve.nl/kevin/iCams/index.html

there are 4 files being used, index.html, index.js, home.js and zoek.js.

The location of each file to view it:

index:
http://webservices.hireserve.nl/kevin/iCams/index.html

JS files
http://webservices.hireserve.nl/kevin/iCams/js/index.js (http://webservices.hireserve.nl/kevin/iCams/index.html)
http://webservices.hireserve.nl/kevin/iCams/js/home.js (http://webservices.hireserve.nl/kevin/iCams/index.html)
http://webservices.hireserve.nl/kevin/iCams/js/zoek.js (http://webservices.hireserve.nl/kevin/iCams/index.html)


kevin

Stuart-SwarmOnline
27 Sep 2010, 1:17 AM
var activeItems[]; is not valid JavaScript. Try var activeItems = []; to set it to a blank array.

The second error is because you are using the var keyword but not giving the variable a name or assigning it. Should be something like



var methodOutput = dockedItems[0].setTitle(button.text);


However, i don't know if setTitle returns anything you would want to store anyway so you might be better just leaving it off altogether.

kevinv1990
27 Sep 2010, 1:31 AM
Thx a lot! It worked, well i changed the activeitems[] to what you said, after i removed all the var's before dockedItems[0] etc. and it worked :D Again, thx a lot!

Now I can continue to the difficult part ^^

steve1964
27 Sep 2010, 1:58 AM
In your code:

// de back button tonen var dockedItems = panel.getDockedItems(); var header = dockedItems[0]; header.getComponent(0).show(); // Titel aanpassen var dockedItems[0].setTitle(button.text);
you first declare

var dockedItems = panel.getDockedItems();
and then you redefine same var

var dockedItems[0].setTitle(button.text);

To open the java console in safari from the menu Develop > Show Error Console