[英]Missing ) after argument list in JS with JQuery
When making a feedreader in Javascript (using google's feed API) I want to use query-ui tabs to differentiate the groups, then accordions for each source in that group. 当用Javascript(使用google的feed API)制作feedreader时,我想使用query-ui选项卡区分组,然后对该组中的每个源使用手风琴。 I'm getting a JS error in FireBug when I try to do container.append(accordionID)
. 尝试执行container.append(accordionID)
时,我在FireBug中收到JS错误。 Besides being unable to spell accordion, it says I am missing a right parens, but I have checked and they all seem matched up. 除了无法拼写手风琴外,它还说我缺少合适的parens,但是我检查了一下,它们似乎都匹配了。 I even moved the string creation out of the call itself to make sure that wasn't the issue. 我什至将字符串创建移出了调用本身,以确保这不是问题。
var feeds = [
{url:"http://feeds.feedburner.com/engadget/Dnjv",
title:"Engadget"}
]; //
function loadFeeds(){
for(var i=0; i<feeds.length;i++){
var source = new google.feeds.Feed(feeds[i].url); //defaults to JSON
source.includeHistoricalEntries();
source.setNumEntries(10);
source.load(function(result){
if(!result.error){
$("#feedsList").append("<li id='#source-"+i+"'>"+feed[i].title+"</li>"); //adds tab for source
var container = $("#sources").append("<div id='source-"+i+"></div>"); //add source in sources section
for(var j=0; j<result.feed.entries.length; j++){
var entry = result.feed.entries[j];
var accordianID = "<div id='accordian"+j+"'>";
container.append(accordianID).html("<h3><a href='#'>"+entry.title+"</a><a href=\'"+entry.link"\'> link</a></h3><div>"+entry.content+"</div></div>");
}
}
})
}
google.setOnLoadCallback(initialize);
}
container.append(accordianID).html("<h3><a href='#'>"+entry.title+"</a><a href=\'"+entry.link"\'> link</a></h3><div>"+entry.content+"</div></div>");
entry.link"\\'> link
应该
entry.link+"\\'> link
You are missing an operator in the following line: 您在以下行中缺少运算符:
container.append(accordianID).html("<h3><a href='#'>"+entry.title+"</a><a href=\'"+entry.link"\'> link</a></h3><div>"+entry.content+"</div></div>");
It doesn't have to do with an "unbalanced" parenthesis directly, but since either an operator or a )
was permissible, this error is the end result. 它不一定与“不平衡”括号直接相关,但是由于允许使用运算符或 )
,因此此错误是最终结果。
(Which operator and where is left as an exercise for the reader.) (哪个运算符和位置留给读者练习。)
Happy coding. 快乐的编码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.