2013-03-11 49 views
0

我使用this javascript在我的頁面上顯示youtube搜索結果。如何使用此javascript顯示youtube視頻ID

這是從代碼中顯示標題,描述等部分...

li.innerHTML = '<table cellspacing="0" cellpadding="0" border="0"> 
<tr><td valign="top" rowspan="2"></td> 
<td valign="top"><h3>'+entry.title+'</h3><span>'+this.formatDescription(entry.description)+'</span></td> 
<td valign="top" style="width: 150px" class="meta"> 
<div>From: <a href="http://www.youtube.com/profile?user='+entry.uploader+'">'+entry.uploader+'</a></div><div>Views: '+entry.viewCount+'</div><div>'+this.formatRating(entry.rating,entry.ratingCount)+' ratings</div>Time: '+this.formatDuration(entry.duration)+'</td></tr></table>'; 

如何添加'+ytPlayerParams.videoId+''+data.id+'或JavaScript的別的東西,所以它會顯示在YouTube視頻ID http://www.youtube.com/embed/...

回答

0
li.innerHTML = '<table cellspacing="0" cellpadding="0" border="0"> 
    <tr><td valign="top" rowspan="2"></td> 
    <td valign="top"> 
     <h3>'+entry.title+'</h3 
     <span>'+this.formatDescription(entry.description)+'</span> 
    </td> 
    <td valign="top" style="width: 150px" class="meta"> 
     <div>From: <a href="http://www.youtube.com/profile?user='+entry.uploader+'">'+entry.uploader+'</a></div> 
     <div>ID: '+entry.id+'</div><div>Views: '+entry.viewCount+'</div><div>'+this.formatRating(entry.rating,entry.ratingCount)+' ratings</div> 
     Time: '+this.formatDuration(entry.duration)+' 
     </td> 
    </tr> 
    </table>'; 

我添加了ID的DIV這將給獨特的視頻ID