且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

js function 嵌套

更新时间:2022-08-13 10:02:43

引用:http://zhidao.baidu.com/question/450337100.html

<html>
<body>

<script type="text/javascript">
function A(){
var p=1;
var q;
this.A = function(x){//用this.变量 赋值一个函数。
q=2;
alert(x+p);
}
this.B = function (x){
alert(p+q+x);
}
}
var a=new A();
a.A(5);
a.B(6);
</script>

</body>
</html>