js function 嵌套

引用: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>
posted @ 2013-01-31 17:16  镇水古月  阅读(568)  评论(1编辑  收藏  举报