如何擴展此範圍?我認爲重新分配一個更高範圍的變量會做伎倆......我做錯了什麼? http://jsfiddle.net/8bqXM/將「this」的範圍轉換爲內部函數
function Player(configs) {
this.opts = {
playerID: "cSurf"
};
configs = $.extend(this.opts, configs);
var the = this;
this.init = function(){
var $player = $("#" + the.configs.playerID);
alert($player.attr("id"));
}
}
var cSurf = new Player();
$(document).ready(function(){
cSurf.init();
});