次のようなプロトタイプ関数を使用して、独自のファイル内にいくつかのJavascript「クラス」を作成しました。
function Playlist(id, name){
this.id = id;
this.name = name;
}
Playlist.prototype.getid = function(){return this.id;}
Playlist.prototype.getname = function(){return this.name;}
この「クラス」のインスタンスを次のように作成します。
var playlist = new Playlist();
複数の HTML ページで 1 つのインスタンスを使用できる方法はありますか? 私はこのように試しました:
"<a href='next.html?pl="+playlist+"'>Next</a>"
しかし、それは私が本当に何もできない[オブジェクト、オブジェクト]だけを与えてくれます。どんな解決策でも大歓迎です。