这是我的代码,我很确定它没问题,但似乎没有用。也许第二种观点可能会有所帮助。条目是搜索结果。
function showMyVideos(data) {
var feed = data.feed;
var entries = feed.entry || [];
var html = ['<ul>'];
for (var i = 0; i < entries.length; i++)
{
var entry = entries[i];
var playCount = entry.yt$statistics.viewCount.valueOf() + ' views';
var title = entry.title.$t;
var lnk = '<a href = \"' + entry.link[0].href + '\">linkcik</a>';
var entPar = objToString(entry.id);
var parseEntries = entPar.split("/");
var videoID = parseEntries[5].substring(0,11)
var params = { allowScriptAccess: "always" };
var atts = { id: "ytPlayer" };
// All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "?version=3&enablejsapi=1&playerapiid=player1",
"videoDiv", "480", "295", "9", null, null, params, atts);
html.push('<li>', title, ', ', playCount, ', ', lnk, '</li>');
}
html.push('</ul>');
document.getElementById('videoResultsDiv').innerHTML = html.join('');
}
答案 0 :(得分:0)
我从未使用过swfobject但是从我看到你创建了一个swf对象并要求将它添加到videoDiv元素中。你确定你想要这种行为吗?
因为我站在那里我认为你应该使用createSWF方法并将返回的对象添加到你的html数组中。