|
<script type="text/javascript" language="javascript">
var FunObj=function(n){
this._n=n;
this.theFunc=function(){
alert(this._n);
}
}
window.onload=function(){
//网页加载完后执行
var p=FunObj();
theFunc();
}
</script>
调用FunObj()时,this===window
里面的this.theFunc=..
相当于window.theFunc=..
这样,window对象就被加入了一个函数
这相当于又添加了一个全局函数...
写JS应用,不能和JS菜鸟合作.... |
|