Expected identifier, string or number

JavaScript related questions should go here.
Post Reply
jonathon
Posts: 50
Joined: Fri May 06, 2011 5:09 pm

Expected identifier, string or number

Post by jonathon »

Hi

I'm having a problem with this piece of code in IE :( it works fine in FF, Opera, Google and I guess Safari as they run the webkit engine.

I can't seem to figure out why, the code in dreamweaver reports no syntax errors either. I suspect it's a rogue comma or something. Can anyone advise?
		window.addEvent('domready', function(e){	
			
			// option 1		
			var slides = [
				{
					image: 'home_slide1.PNG',	
				}, // Line 7 error??
				{
					image: 'chest1.jpg',
				},
				{
					image: 'treehouse1.JPG',
				},
				{
					image: 'barn_slide.JPG',
				},
				{
					image: 'treehouse2.JPG',
				},
				{
					image: 'bathroom1.jpg',
				},
				{
					image: 'joinery_slide.JPG',
				},
				{
					image: 'plans1.jpg',
				},
				{
					image: 'taps1.jpg',
				},
				{
					image: 'hand_made.JPG',
				},
				{
					image: 'forest1.jpg',
				},
				{
					image: 'kitchen3.JPG',
				},
				{
					image: 'river1.jpg',
				},
				{
					image: 'decking1.jpg',
				},
				{
					image: 'barn1.jpg',
				},
				{
					image: 'draw1.jpg',
				}
				
				
				
			];
			
			// option 2
			// var slides = $$('#blinds img');

			$('blinds').floom(slides, {
				slidesBase: 'slides/',
				sliceFxIn: {
					top: 20
				}
			});
			
		});
I get this error from IE:

Message: Expected identifier, string or number
Line: 7
Char: 5

Line 7 is noted above.

If anyone can help me, i'd be really grateful, thanks

Jonathon
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Expected identifier, string or number

Post by jacek »

Looks okay to me, have you tried the Ie debugger thing ? It may give more information.
Image
jonathon
Posts: 50
Joined: Fri May 06, 2011 5:09 pm

Re: Expected identifier, string or number

Post by jonathon »

Cant find any warnings or errors for that particular file :S

I don't see why it's wrong either as they're all set out in that order and if that was an error on line 7 then surely all the other '},' would be errors....
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Expected identifier, string or number

Post by Temor »

It's probably just IE being silly, as always.
jonathon
Posts: 50
Joined: Fri May 06, 2011 5:09 pm

Re: Expected identifier, string or number

Post by jonathon »

Yes, I have no doubt, but it still needs to be fixed sadly else the page won't work :-(
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Expected identifier, string or number

Post by jacek »

Try removing the , from the end of these lines
image: 'home_slide1.PNG', 
Image
jonathon
Posts: 50
Joined: Fri May 06, 2011 5:09 pm

Re: Expected identifier, string or number

Post by jonathon »

Problem, Solved I hope and think

Had to remove the trailing commas like so:
                    window.addEvent('domready', function(e){       
                           
                            // option 1            
                            var slides = [
                                    {
                                            image: 'home_slide1.PNG'      
                                    }, 
                                    {
                                            image: 'chest1.jpg'
                                    },
                                    {
                                            image: 'treehouse1.JPG'
                                    },
                                    {
                                            image: 'barn_slide.JPG'
                                    },
                                    {
                                            image: 'treehouse2.JPG'
                                    },
                                    {
                                            image: 'bathroom1.jpg'
                                    },
                                    {
                                            image: 'joinery_slide.JPG'
                                    },
                                    {
                                            image: 'plans1.jpg'
                                    },
                                    {
                                            image: 'taps1.jpg'
                                    },
                                    {
                                            image: 'hand_made.JPG'
                                    },
                                    {
                                            image: 'forest1.jpg'
                                    },
                                    {
                                            image: 'kitchen3.JPG'
                                    },
                                    {
                                            image: 'river1.jpg'
                                    },
                                    {
                                            image: 'decking1.jpg'
                                    },
                                    {
                                            image: 'barn1.jpg'
                                    },
                                    {
                                            image: 'draw1.jpg'
                                    }
                                   
                                   
                                   
                            ];
                           
                            // option 2
                            // var slides = $$('#blinds img');
     
                            $('blinds').floom(slides, {
                                    slidesBase: 'slides/',
                                    sliceFxIn: {
                                            top: 20
                                    }
                            });
                           
                    });
     

User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Expected identifier, string or number

Post by jacek »

Awesome :D
Image
jonathon
Posts: 50
Joined: Fri May 06, 2011 5:09 pm

Re: Expected identifier, string or number

Post by jonathon »

Yep this was the case :) Thanks for alls input
Post Reply