ex11-6.htm

来自「有关JAVASCRIPT的源代码教程」· HTM 代码 · 共 34 行

HTM
34
字号
   <html><head><title>显示form对象的所有属性 </title></head>
   <body> <h2>form对象属性列表 <h2>
   <form name="form1">姓名: 
    <input type="text"
       name="myname"> 
    <input type="button"
       name="button1"
       value="确定"
   </form>      
   <script language="JavaScript">
       <!--        
       var attrs=new Array();
       for ( var property in window.document.forms[0]){
          attrs.push(property);
       }
       attrs.sort();
       document.write( "<table>");
       for(i=0;i<attrs.length; i++){
          if (i==0){
            document.write("<tr>");
          }
          if( i>0 && i%5 == 0 ){
              document.write("</tr><tr>");
          }
          document.write( "<td>"+attrs[i] + "</td>");
       }
       document.write( "</table>");
       //-->        
   </script>
   </body></html>



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?