面向对象中级
-
面向对象实例:选项卡
-
改写面向过程的选项卡
image.png
-
改写面向对象程序的四要素
-
this 什么时候会出错
<script>
function Bbb()
{
var _this=this;
this.b=5;
document.getElementById('btn1').onclick=function ()
{
_this.show();
};
}
Bbb.prototype.show=function ()
{
alert(this.b);
};
window.onload=function ()
{
new Bbb();
};
</script>
</head>
<body>
<input id="btn1" type="button" value="按钮" />
</body>
网友评论