Open littleflute opened 7 years ago
<!DOCTYPE html>
<html>
<body>
<style>
#player{
border:1px green solid;
}
#debug{
border:1px blue solid;
}
</style>
<button onclick="test();">xd</button>
<div id="player"></div><br>
<div id="debug"></div>
<script>
function player(cdID,cdRoot) {
this.cdID = cdID;
this.cdRoot = cdRoot;
this.play = function(i)//paly song i
{
alert("play:" + this.cdID);
};
this.debug = function()
{
var o = document.getElementById("debug");
var html = o.innerHTML;
html += this.cdID ;
html += "<br>";
html += this.cdRoot ;
html += "<br>";
o.innerHTML = html;
};
}
var cd1 = new player("cd1", "Doe");
function test()
{
cd1.debug();
}
</script>
</body>
</html>
https://www.w3schools.com/js/js_object_prototypes.asp https://www.w3schools.com/js/tryit.asp?filename=tryjs_object_prototype1