<html>
<head>
<script type="text/javascript">
function myClass()
{
//假设以下隐藏
    this.name;
    this.play = function()
    {
        //..
    }
//假设以上隐藏
}
myobj = new myClass()
for(key in myobj){
document.write(key+":"+myobj[key].toString()+"<br>"
}
</script>
</head><body>
</body>
</html>

解决方案 »

  1.   

    <html> 
    <head> 
    <script type="text/javascript"> 
    function myClass() 

    //假设以下隐藏 
        this.name; 
        this.play = function() 
        { 
            //.. 
        } 
    //假设以上隐藏 

    myobj = new myClass() 
    for(key in myobj){ 
    document.write(key+":"+myobj[key].toString()+" <br>"); 

    </script> 
    </head> <body> 
    </body> 
    </html> 
      

  2.   

          function classA()
          {
            this._name="hello";
          }
          
          window.alert(classA.toString());
      

  3.   

    你是想看myClass这个函数的写法吗??
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <script type="text/javascript">
    <!--
    function myClass(a){
    this.a=a;
    alert("OK");
    }
    alert(myClass.toString());
    //-->
    </script>
    </head>
    <body>
    </body>
    </html>
      

  4.   

    var o=new myClass()
    for(i in o)
    {
      alert("o["+i+"]="+o[i]);
    }