3
votes

In IE8 on vista I am getting the following JS error,

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
Timestamp: Thu, 1 Sep 2011 12:18:24 UTC

Message: Object doesn't support this property or method Line: 28
Char: 2 Code: 0 URI:
http://www.safetymaintenancecompany.co.uk/media/js/site.js

Below is my code of said file,

$(document).ready(function(){

Cufon.replace('dd h1', { 'fontSize': '50px', 'letterSpacing': '-4px'} ); // Works without a selector engine

$('#slides').slides({
    preload: true,
    preloadImage: '../images/loading.gif',
    play: 5000,
    pause: 2500,
    slideSpeed: 600,
    hoverPause: true,
    generatePagination:false
});

//$('footer').height( ($(window).height() - $('#main').height() + "px" ));


$('.title').click(function(event){
    event.preventDefault();
});

$('.basic li > h2').hover(function(event) {
    $(this).addClass('hover');
}, function() {
    $(this).removeClass('hover');
});

$("#contactForm").validate({
    rules: {
        name: "required",
        email_address: {
            required: true,
            email: true
        },
        phone_number: {
            required: true
        }
    }
});

});

I honestly cannot see an problems with this code, is there some wrong with it?

2
Which is line 28? If it's $("#contactForm").validate({ then that maybe because the validation plugin isn't loaded. - RoToRa
is the problem just in IE , what about firefox. Can you reach line 28 on your js. - sushil bharwani
What RoToRa said seems most likely, but it would be occurring in all browsers if that's the problem. Is this IE8 only, or is that the only browser you've tested it in? - jmar777
@jmar777 it is IE8 only and more specifically only seems to happen with IE8 in vista. The js plugin for this is hosted on a different server could that be causing problems? And if so how come loading jQuery in from Google is not causing problems? - Udders
I'm not very practiced in IE's debugging tools, so I won't try to explain how they could help, but the low-tech way to narrow down the problem would be to comment everything out and then add a bit back at a time until you get the error. Or comment things out one at a time until the error goes away. - nnnnnn

2 Answers

0
votes

If I can count correctly, that's the $("#contactForm").validate line, so maybe $("#contactForm") returns null? You might try alert-in the result first, just to be sure if $("#contactForm") is the problem, or a missing validation plugin.

0
votes

It turned out that IE8 did not appreciate me hot linking to the validation library, however this was only in Vista. I realise that sounds almost impossible but those are the facts.