以下のテストコードを書いたのですが、「test1」を表示したいのですobj.my().showTxt()
が何も表示されません。ありがとう!
<html>
<body>
Primitive and String Objects
<script type="text/javascript">
function Class1() {
this.showTxt = function () { alert(this.name) }
}
Object.prototype.my = Class1;
var obj = new Object();
obj.name = "test1";
obj.my().showTxt();
</script>
</body>
</html>