首先需要说的一点是这段代码使用了with语句,with语句的作用就是对要操作的属性指定默认对象,比如你要操作
MyObj这个对象的a、b、c三个属性,传统的做法是写三条设置语句
MyObj.a=**;
MyObj.b=**;
MyObj.c=**;
每次都需要制定MyObj如果MyObj很长如document.getElementById.....写起来就比较麻烦,使用with就简单了
with(MyObj){
   a=**;
   b=**;
   c=**;
}
这一点理解上面的语句就好理解了,他用with语句设置了一个name=classForm的表单中的一些控件进行设置
defaultValue是自定义的属性

解决方案 »

  1.   

    稍微纠正一下
    defaultValue是自带的,htmlref手册里有
    只不过很少用,可能也只支持ie
      

  2.   

    查了一下:
    The value of the property can be changed programmatically, but doing so has no effect on the appearance of the object or the submitted value. It does, however, change the initial value of the object when the form is reset看来是用在form.reset()