JavaScript Gotcha in IE7

I thought for a while that I was done with Web development. I mean the HTML, CSS, JavaScript stack specifically. WPF and Silverlight have just been so much more fun.

Well, despite that sentiment my weekends have been full for the last couple of months with HTML, CSS, and JavaScript work for Silver Arcade. Surprisingly, I have found it refreshing.

In fact, it’s even influenced my WPF development, but that’s another post.

Silver Arcade passes around a lot of data using JSON. I kept having problems with IE7 and spent too much time scratching my head.

Take a look at this little bit of jQuery that wires up the featured games rotator on the home page.

jQuery(function($) {
    $('#rotator-content').cycle({
        fx: 'scrollLeft',
        easing: 'easeOutQuad', 
        speed: 1000,
        timeout: 6000,
        next: '#next-feature',
        prev: '#prev-feature' ,
        pause:1,
    });
});

This code executes correctly in IE 8, Firefox 3, Safari 4, and Chrome. It breaks in IE 7. (It also works in Opera, but there are other problems there.)

The problem is the comma on the last line. IE 7 expects something more because of the comma. Specifically, the error is:

“Expected identifier, string or number”


Posted 05-03-2009 6:10 PM by Christopher Bennage

[Advertisement]

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)