var objtest = new TestClass();
alert (objtest.property1 );

解决方案 »

  1.   

    楼上的可能搞错了,我是说在
    oForm.onsubmit = function() {
        //validate line
      }
    括号中的代码中如何访问类的属性
      

  2.   

    CSS滤镜问题?
    怎样在ASP中使表格(页面)有翻页的效果?
      

  3.   

    //一样
    oForm.onsubmit = function() {
               var objtest = new TestClass(oForm);
               alert (objtest.property1 );
          }
      

  4.   

    楼上的可能还是没搞清楚,我这段代码是写在TestClass类里面的
      

  5.   

    function TestClass(oForm) {
      this.property1 = 1;
      this.property = 2;
      property1 = this.property1;
      property2 = this.property2;
      oForm.onsubmit = function() {
        //validate line
        alert(property1);
      }
    }
      

  6.   

    <form name=ff><input type=submit></form><SCRIPT LANGUAGE="JavaScript">
    <!--
    function TestClass(oForm) {
      this.property1 = 1;
      this.property = 2;
      TestClass.handle = this;  oForm.onsubmit = function() {
        alert(TestClass.handle.property1);
        return false;
        //validate line
      }
    }
    var a = new TestClass(document.ff);
    //-->
    </SCRIPT>
      

  7.   

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function TestClass() {
    this.property1 = 1;
    this.property = 2;    //validate line
    this.show =  function a() {
    for( obj in this){
    document.write( obj + " = " + this[obj] + "<br>" + "\n" );
    }
    return ;
    }
    }
    document.write( "===============   objtest   ==============" + "<br>" + "\n" );
    var objtest = new TestClass();
    objtest.property1 = 2;
    objtest.show();document.write( "=================  objtest1   =============" + "<br>" + "\n" ); var objtest1 = new TestClass();
    objtest1.property1 = 10000000000;
    objtest1.property = 10000000000;
    objtest1.show();document.write( "================   objtest2   ===========" + "<br>" + "\n" ); var objtest2 = new TestClass();
    objtest2.show();
    //-->
    </SCRIPT>