4

The following script below is not running in IE7 but works perfectly fine in IE 8 + 9 and ALL other browsers. Even putting in the alert("something"); does not work - I have another script that is working fine and that is running in IE 7 perfectly.

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

Am I missing a DOCTYPE? Here is the script below;

var formPageTitle = $("div.hsRadarform td h3").text(); 

$('.AspNet-DataList td a').each(function (index) {        
    var listElementText = $(this).text();
    var shade = "faint";

    if(formPageTitle.toLowerCase() == listElementText.toLowerCase()) {
        shade = "dark";
    }

    //adding the numbered circles here using jQuery
    $(this).css({ 
        'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)',
        'background-repeat': 'no-repeat',
        'height': '25px',
        'width': '25px',
    });
});
2
  • @Daniel A. White none being picked up in FF Commented Dec 2, 2011 at 13:47
  • 2
    @c-sharpnewbie see this -> stackoverflow.com/questions/7246618/… Commented Dec 2, 2011 at 13:54

1 Answer 1

14

IE is very picky with trailing commas :

$(this).css({ 'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)',
    'background-repeat': 'no-repeat',
    'height': '25px',
    'width': '25px',
});

Should be

$(this).css({ 'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)',
    'background-repeat': 'no-repeat',
    'height': '25px',
    'width': '25px' // comma removed
});
Sign up to request clarification or add additional context in comments.

5 Comments

that comma was causing the problem - working now in all browsers - not bothering with IE6. One little comma and IE is very picky - they shouldnt be too picky - they could drive people crazy LOL. Cheers - will mark it as the answer - wont let me just now only afer 5 minutes.
"they could drive people crazy" they do ... I deal with anomalies between IE / Firefox / Safari and Chrome on a daily basis ...
i have TR and TD's inside that when i give it a float: left; i want it to display all on one line - for some reason its not having it in IE7 - IE 8 + 9 is fine - no tweaking is needed there.
@c-sharpnewbie Sorry but I dont quite understand you question - your better off raising another question on here with some source ...
never mind had a look around - seems you cant float TD or TR elements in IE7 (I'll just hide it) thanks for your help, enjoy the rest of your day.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.