不记得out是不是需要初始化了你看这样行不?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
  </head>
  <body>
 <script language="javascript">
 var o=new Object;
 o.name='dc';
 alert(o.name);
 
 function changeValue(n){
  n.name='mm'
 }
 changeValue(o);
 
 alert(o.name);
 </script>  </body></HTML>

解决方案 »

  1.   

    JS也可以实现类的功能,但不是真正的oop哪种类!我的BLOG中有介绍,你也可以看一下哪些AJAX框架的代码,对你会有帮助的
      

  2.   

    function Cart() {  
        this.items = [];  
     }    
     function Item (id,name,desc,price)) {  
        this.id = id;  
        this.name = name;  
        this.desc = desc;  
        this.price = price;  
     }    
     // Create an instance of the cart and add an item  
     var cart = new Cart();  
     cart.items.push(new Item("id-1","paper","something you write on",5));  
     cart.items.push(new Item("id-1","Pen", "Something you write with", 3);  
     
     var total;  
     while (var l; l < cart.items.length; l++) {  
        total = total + cart.items[l].price;  
     }  
     
    上面的 Cart 对象为维护内部的 Item 对象数组提供了基本支持