面向对象(this的问题一)

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script>

function zgz()
{
var _this=this
this.a=5;

setInterval(function(){

_this.show()

},2000)
}

zgz.prototype.show=function(){

alert(this.a)

}

var oBj=new zgz()


</script>
</head>

<body>
</body>
</html>

原文地址:https://www.cnblogs.com/Greenzgz/p/4277973.html