2011-02-20 26 views
1

这段代码不会产生任何错误:为什么在分号上出现语法错误?

//if the image has tags 
if(data.photo.tags.tag != '') { 

    //create an empty array to contain all the tags 
    var tagsArr = new Array(); 

    //for each tag, run this function 
    $.each(data.photo.tags.tag, function(j, item){ 

     //push each tag into the empty 'tagsArr' created above 
     tagsArr.push('<a href="http://www.flickr.com/photos/tags/' + item._content + '">' + item.raw + '</a>'); 

    }); 

    //turn the tags array into a string variable 
    //var tags = tagsArr.join(' '); 
} 

但如果我改变标签阵推线:

//push each tag into the empty 'tagsArr' created above 
    tagsArr.push(+ item.raw +);          
}); 

然后我得到的分号语法错误。我试图做的是删除标记的链接,只是返回原始链接。

想法&谢谢!

+0

你试图添加* *的括号的一些价值。 – delnan

回答

2

如果你只是想输出的item.raw值做:

tagsArr.push(item.raw); 
相关问题