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>