This Is A FineDay

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  93 随笔 :: 0 文章 :: 69 评论 :: 0 Trackbacks
Js的Object有点意思
<script language="javascript" type="text/javascript">
<!--
var test = {
 aaa:{
  a:function(){alert("sa");}
 },
 bbb:{
  b:function(){test.aaa.a();}
 }
}
//test.aaa.a();
//test.bbb.b();
var testa = {
        test1:{
          ggg:function(){alert(123);}
        },
        test2:{
          do2:function(){testa.test1.ggg();}
        }
};
//testa.test1.ggg();
//testa.test2.do2();
alert(Object);
Object.extend = function(destination, source) {
 for (var property in source) {
  destination[property] = source[property];
 }
 return destination;
}
Object.extend(Object,{
    ggg:function(object){alert(123);}
 ,
 do2:function(object){
  var i=0;
  for (var property in object){
   alert((i++) + property);
  }
 object.ggg();
 }
 }
);
Object.do2(Object);
//alert(Object);
//-->
</script>
posted on 2007-01-23 18:12 Peter Pan 阅读(984) 评论(0)  编辑  收藏 所属分类: JS

只有注册用户登录后才能发表评论。


网站导航: