开发者

Jquery works in Firefox, Safari & Opera but not IE?

This is weird. I am testing to see if JQuery is installed by adding an alert.

This works fine in Firefox, safari, opera and chrome, but IE 6/7 simply do not show the alert. JavaScript is enabled. Has anybody ever come accross this?

$(document).ready(func开发者_如何学Pythontion()
{ 
   alert('Test');
});


You have unnecessary comas in your javascript in several places in your inline object declarations.

$('a#n-america').qtip({
              content: 'Nouth America',
              show: 'mouseover',
              hide: 'mouseout',
              style: { name: 'cream' },  // <<<<< LIKE HERE
        })

Firefox is tolerant of that. But IE will simply refuse to run that entire javascript code section.

Technically IE is right, it's badly constructed javascript..

Ben


Can you post the rest of your HTML here? It may be because the HTML that you're creating is not becoming "ready" (lack of ending tags, etc)


Are you including the jQuery script? Do you have a valid doctype? Furthermore, are your script tags properly noted ( not ). Try using the IE error console (in the tools menu), which might provide a reason why the javascript isn't working. It looks like a problem with the format of you html. Different browsers parse bad or incorrect html in different ways. IE 6-7-8 do work with jQuery, so it doesn't have to do with jquery.


Is the file you are testing on your local hard drive or on the internet somewhere? Internet Explorer doesn't execute Javascript on local html files, unless you click "Allow blocked content" on the yellow bar that pops up.


You have trailing comma's in your n-america and c-america definitions. This will break in IE6 and work fine pretty much everywhere else. Arrays have to end with no trailing comma in IE6.

EDIT: Beat me by 6 seconds. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜