我正在寻找在我的页面上选择的特定项目的标题:
function response(jsonData) {
var items = jsonData["items"];
var tDiv = document.getElementById("dynamicVideos");
var uDiv = document.getElementById("videoInfo");
var i=0;
while (i<items.length) {
var str = "";
str += '<div class="tvVideo">';
str += '<div class="thumb" onClick="playTitleFromList(' + items[i].id + ')"><img src="' + items[i].thumbnailURL + '"/></div>';
str += '<p class="vidTitle">' + items[i].name + ' (' + formatTime(items[i].length) + ')'+ '</p>';
str += '<p class="vidDescription">' + items[i].shortDescription + '</p>';
str += '</div>';
tDiv.innerHTML += str;
i++;
}
var str2 = "";
str2 += '<div class="videoTitle">';
str2 += '<h3 id="videoTitle">' + items[0].name + '</h3>';
str2 += '</div><!-- Video Title -->';
str2 += '<div class="videoDescription">';
str2 += '<p id="videoDescription">' + items[0].longDescription + '</p>';
str2 += '</div><!-- Video Description -->';
str2 += '<div class="divide"></div>';
str2 += '<div id="videoDonate"></div>';
str2 += '<div id="videoTAF"></div>';
str2 += '<div id="videoTime"></div>';
uDiv.innerHTML += str2;
}
代码的底部应显示所选视频的信息,因为顶部代码块返回视频列表。