繁体   English   中英

页面加载404错误

[英]404 error on page load

加载此页面时,Firebug中将显示以下内容:

NetworkError: 404 Not Found - http://summer-festivals.cloudfoundry.com/undefined

我已将错误归因于呈现轮播的JQuery插件 如果删除此插件和调用它的代码,该错误消失。

但是,我无法弄清楚该插件试图检索导致该错误的内容。 轮播本身使用的所有图像(例如,上一个,下一个,暂停按钮),以及轮播显示的图像均已正确加载,我无法想象它可能还会尝试下载什么。

在进行了一些调试之后(都称赞了firebug),我将其范围缩小到了从175行开始的for循环:

for(i=0;i<=numImages-1;i++)
{
thumb = $('img:eq('+(i+1)+')', obj).attr('src');
// $('#thumbs'+randID).append('<div class="thumb" id="thumb'+randID+'_'+(i+1)+'" style="cursor:pointer;background-image:url('+thumb+');display:inline;float:left;width:'+o.thumbnailWidth+';height:'+o.thumbnailHeight+';line-height:'+o.thumbnailHeight+';padding:0;overflow:hidden;text-align:center;border:2px solid #ccc;margin-right:4px;font-size:'+o.thumbnailFontSize+';font-family:Arial;color:#000;text-shadow:0 0 3px #fff">'+(i+1)+'</div>');
$('#thumbs'+randID).append('<div class="thumb" id="thumb'+randID+'_'+(i+1)+'" style="cursor:pointer;display:inline;float:left;width:'+o.thumbnailWidth+';height:'+o.thumbnailHeight+';padding:0;overflow:hidden;text-align:center;border:2px solid #ccc;margin-right:4px;font-size:'+o.thumbnailFontSize+';font-family:Arial;color:#000;text-shadow:0 0 3px #fff"><img src="'+thumb+'" width="'+o.thumbnailWidth+'" height="'+o.thumbnailHeight+'" alt="" /></div>');
// $('#thumbs'+randID).append('<div class="thumb" id="thumb'+randID+'_'+(i+1)+'" style="cursor:pointer;display:inline;float:left;width:'+o.thumbnailWidth+';height:'+o.thumbnailHeight+';padding:0;overflow:hidden;text-align:center;border:2px solid #ccc;margin-right:4px;font-size:'+o.thumbnailFontSize+';font-family:Arial;color:#000;text-shadow:0 0 3px #fff"><img src="thumbnail.php?i='+thumb+'&w='+o.thumbnailWidth+'&h='+o.thumbnailHeight+'&q=100" alt="" /></div>');
if(i<=o.inView) $('#thumb'+randID+'_'+i).css({'border-color':'#ff0000'});
unviewable.push(i+1);
} 

似乎出错的地方在于选择器中的i+1 objdiv#carousel ,它具有9个图像( numImages正确设置为9)。

但是,选择器从1到9循环,而我相信它应该从0到8循环(通过在监视窗口中粘贴内容来实现)。 这意味着,当要评估$('img:eq(9)', obj)它什么也得不到,所以src属性为“ undefined”。 然后,它尝试添加带有“ undefined”的图像,因为src出错了。

它看起来像轮播代码中的错误,所以我可能建议尝试与他们讨论。 您也许可以通过将i + 1替换为i来修复它,但是我对此不做任何保证。 :)

在调用所有资源之前,请尝试将主库调用放在标头标记中。

这些都应该仍在标题中。 您的文档ready()内容可以留在页脚中。 查看是否可以解决您的问题。

<script src="/static/js/namespace.js" type="text/javascript" ></script>
<script src="/static/js/global.js" type="text/javascript" ></script>
<script src="/static/js/slide.js" type="text/javascript" ></script>
<script src="/static/js/superfish/hoverIntent.js" type="text/javascript" ></script>
<script src="/static/js/superfish/superfish.js" type="text/javascript" ></script>
<script src="/static/js/superfish/supersubs.js" type="text/javascript" ></script>
<script src="/static/js/tablesorter/jquery.tablesorter.min.js" type="text/javascript" ></script>
<script src="/static/js/tablesorter/jquery.metadata.js" type="text/javascript" >  </script>
<script src="/static/js/tablesorter/init.js" type="text/javascript" ></script>
<script src="/static/js/jquery.simplemodal.1.4.2.min.js" type="text/javascript" >     </script>
<script src="/static/js/carousel/jquery.infinitecarousel2-thumbmod-1.js" type="text/javascript" ></script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM