我想新的iFrame阿比examlpe @ http://code.google.com/apis/youtube/iframe_api_reference.html(下面的代碼在這裏..)Youtube iFrame Api示例 - 錯誤:「JSON未定義」?
萬物工作prerfect在Chrome,Safari但 在Firefox 3.0和IE6報告錯誤 - > JSON未定義的行:13 玩家仍在工作,但JavaScript的完全崩潰。
我試圖讓頁面頂部json2.js庫(http://www.json.org/)腳本,但沒有效果更好。 如何在這些舊瀏覽器上安排此JSON錯誤?
<html>
<body>
<!-- 1. The <div> tag will contain the <iframe> (and video player) -->
<div id="player"></div>
<script src="js/json2.js"></script>
<script language="javascript">
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: 'u1zgFlCw8Aw',
playerVars: { 'autoplay': 1, 'controls': 0, 'showinfo': 0, 'loop': 1, 'rel' : 0, 'showsearch' : 0, 'enablejsapi' : 1},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
event.target.playVideo();
}
function onPlayerStateChange(event) {
//
}
</script>
</body>
</html>
剛剛找到如何在IE6 http://stackoverflow.com/questions/1787020/json-object-in-ie6-how修復JSON這個較早的帖子 – Spider 2011-09-19 21:49:02