onReady 未被调用
onReady not being called
var player = null;
function LoadYouTubeIframeAPI() {
var scriptElement = document.createElement("script");
scriptElement.src = "http://www.youtube.com/iframe_api";
var firstScriptElement = document.getElementsByTagName("script")[0];
firstScriptElement.parentNode.insertBefore(scriptElement, firstScriptElement);
}
function onYouTubeIframeAPIReady() {
var playerParams = {
playerVars: {
"enablejsapi": 1,
"origin": document.domain,
"rel": 0
},
events: {
"onReady": onPlayerReady,
"onError": onPlayerError,
"onStateChange": onPlayerStateChange
}
};
player = new YT.Player("player", playerParams);
}
function onPlayerReady(event) {
alert("ready")
}
function onPlayerError(event) {}
function onPlayerStateChange(event) {}
这是我的完整代码。
function onPlayerReady(event) {
alert("ready")
}
从未因为某种原因被解雇。有人能帮忙吗?我几个小时都无法让它工作。Google 对我一点帮助都没有。
var player = null;
function LoadYouTubeIframeAPI() {
var scriptElement = document.createElement("script");
scriptElement.src = "http://www.youtube.com/iframe_api";
var firstScriptElement = document.getElementsByTagName("script")[0];
firstScriptElement.parentNode.insertBefore(scriptElement, firstScriptElement);
}
function onYouTubeIframeAPIReady() {
var playerParams = {
playerVars: {
"enablejsapi": 1,
"origin": document.domain,
"rel": 0
},
events: {
"onReady": onPlayerReady,
"onError": onPlayerError,
"onStateChange": onPlayerStateChange
}
};
player = new YT.Player("player", playerParams);
}
function onPlayerReady(event) {
alert("ready")
}
function onPlayerError(event) {}
function onPlayerStateChange(event) {}
这是我的完整代码。
function onPlayerReady(event) {
alert("ready")
}
从未因为某种原因被解雇。有人能帮忙吗?我几个小时都无法让它工作。Google 对我一点帮助都没有。