0
我的jQuery代码获取XML数据在IE 7或IE 8中不起作用,它在IE9和其他所有工具中都可以使用。我不知道为什么会发生这种情况。任何帮助是极大的赞赏!我在Drupal工作,所以我使用jQuery而不是$符号。我对编程也很新,所以任何建议都很棒。.get XML数据在Internet Explorer 7或8中不起作用
jQuery(document).ready(function() {
jQuery.get('/xml/designs.xml',function(data){
jQuery(data).find('slide').each(function(){
var slide = jQuery(this);
var caption = slide.find('caption').text();
var source = slide.find('source').text()
var html = '<li class="mySlides"><a href="' + caption + '_Letterpress_Wedding_Invitation"><img src="/sites/aerialist.localhost/files/images/selectThumbs/' + source + '.jpg"/><p>' + caption + '</p><a>';
var htmlPad = '<li class="mySlides"><a href="' + caption + '_Letterpress_Wedding_Invitation"><img src="/sites/aerialist.localhost/files/images/selectThumbs/' + source + '600.jpg"/><p>' + caption + '</p><a>';
if (window.devicePixelRatio > 1) {
jQuery('#list').append(htmlPad);
jQuery('#list').hide();
jQuery('#list').fadeIn(800);
} else {
jQuery('#list').append(html);
jQuery('#list').hide();
jQuery('#list').fadeIn(800);
}
});
return false;
})
});
在IE8中打开Developer Tools以查看发生了什么。 F12。 –
任何错误消息? – epascarello
IE hates invalid html ...''''''''''标签没有关闭,我会测试'window.devicePixelRatio'是否在旧版本IE中合法,因为我不熟悉它是什么 – charlietfl