1.使用eval()
3.使用for ... in 得到

解决方案 »

  1.   

    <script>
    function myClass(){
    this.id=1
    this.str="abc"
    }
    c=new myClass()
    alert(c.constructor)
    for(ob in c)alert(ob)
    </script>
      

  2.   

    <script language=javascript>
    function myobj(){
    this.aa="asdf"
    this.bb="fff"
    }
    var s="myobj"
    var test=eval("new " + s)
    for(p in test){
    alert(p)
    }
    </script>
      

  3.   

    第二个问题还没有答案呢,
    如何根据一个具体的对象来得到他的function的名称?在就是通过一下语句得到的包括了这个对象所有的属性,方法以及具体值,有什么办法能把上诉三者区分呢?
    for(p in test){
    alert(p)
    }
      

  4.   

    就是秋水说的constructorfunction AA()
    {
        this.v=3;
    }
    var a=new AA();
    var b=new a.constructor();
    alert(b.v);
      

  5.   

    new Funciont("...")
      ∧ ∧
    ( ⊙_⊙ ) 祝所有人好运!我会天天Happy的。
      

  6.   

    <script>
    function myClass(){
    this.id=1
    this.str="abc"
    this.func=go
    }
    function go(){
    alert();
    }
    c=new myClass()
    for(ob in c)if(typeof(c[ob])!="function")alert(ob)
    </script>
      

  7.   

    利用秋水所说的函数的constructor属性可以得到函数名:
    <script>
    function myClass(){
    this.id=1
    this.str="abc"
    }
    c=new myClass()
    var str = "" + c.constructor;
    var index = str.indexOf("(");
    alert(str.substring(8, index));
    </script>