我有兩個函數,用swfobject.js和jquery從youtube rss獲取一些json數據。IE8不會運行特定的JS功能,但會運行類似代碼的另一個功能
這兩個函數都使用非常相似的代碼來將視頻與swfobject.js一起嵌入。我加載IE8,當彈出對話框說:
Line: 4
Char: 5
Error: not implemented
Code: 0
如果我打是的,所有的視頻加載。如果我點擊「否」,則只會加載3個視頻中的一個。我只想知道爲什麼其中一個會加載,但其他人會加載。有沒有IE8在這裏不喜歡的一些令人反感的代碼?
的加載,如果我打yes或no是這裏的一個代碼:
function getVideo(videoID, divName){//Gets yt video for yt category posts
var videoURL = videoID;
var divID = divName+'-video';
var width = 392; //only change this number
var height = Math.floor(width*9/16);
var params = { allowScriptAccess: "always" };
var atts = { 'class': 'hmt-ytvideo' };
swfobject.embedSWF("http://www.youtube.com/v/"+videoURL+"?enablejsapi=1&playerapiid=ytplayer&version=3",
divID, width, height, "8", null, null, params, atts);
}
<script type="text/javascript">
var youtubeID = '<?php echo $urlYoutube; //pass the php var to js var?>';
var divID = '<?php echo $divName; //pass the php var to js var?>';
addLoadEvent(getVideo(youtubeID, divID));//Onload function to output video
</script>
用於加載時,我打是,當我打沒有不加載一個代碼是在這裏:
function getFirstSideVideo(){
//First sidebar video, represented by the url 'start-index' value
$j.getJSON(rssFeedURL, function(data) {
$j.each(data.feed.entry, function(i, item) {
var updated = item.updated;
var urlLink = item['link'][4]['href'];
var width = 315; //only change this number
var height = width*9/16;
//SWF object params
var videoURL = urlLink.split('/uploads/')[1];
var params = { allowScriptAccess: "always" };
var atts = { 'class': 'hmt-ytvideo' };
var divID = 'first-sidebar-video';
//Output video with swf object
swfobject.embedSWF("http://www.youtube.com/v/"+videoURL+"?enablejsapi=1&playerapiid=ytplayer&version=3",
divID, width, height, "8", null, null, params, atts);
});
});
}
<script type="text/javascript">//Onloads the function to output the video
addLoadEvent(getFirstSideVideo);
</script>
謝謝,這只是幫助我決定寫我的onload代碼,如:window.onload = function(){ \t \t getVideo(youtubeID,divID); \t \t getFirstSideVideo();} – 2012-08-11 05:20:29