【发布时间】:2010-12-06 09:07:34
【问题描述】:
我有这样的代码
<script>$(document).ready(function(){
var myPlayList = [];
//document.write(whatTo);
//New instance of jPlayerSkin
var skin = new jPlayerSkin( '#jplayer_container' , myPlayList );
//Start the player
skin.initialize();
});
</script>
我有函数,即function updatePlaylist(song,title,url) { /* code */ }
现在我只想在 document.ready 中执行这个 updatePlaylist 函数,因为在这个函数中我还调用了 skin.add() ,它只在 document.ready 中可用。但是当我将函数放在 document.ready() 中时,我无法执行它,如果我将它放在外面,我可以执行该函数但它无法访问 skin.add()。
【问题讨论】:
标签: jquery function execute document-ready