function show(){
var theForm = document.form;
for(i =0; i<theForm.length;i++){
alert(theForm.elements[i].name+"---"+theForm.elements[i].type);
}}

解决方案 »

  1.   

    <input readonly><script>
    function a(){
    var p=document.f.elements;
    s=""
    for(i=0;i<p.length;i++)s+='\nname:'+p[i].name+'\ttype:'+p[i].type
    alert(s)
    }
    </script>
    <form name=f>
    <input name=cc><input type=checkbox name=r>
    <input type=submit onclick=a()>
    </form>
      

  2.   

    readonlydocument.表單名.elements[索引號].name   名稱
    document.表單名.elements[索引號].type   類型
      

  3.   

    <html><head><script>
    function get_type()
    {
       
       var t=""
       var n=""
       for(var i=0;i<=f1.length-1;i++)  //遍历整个表单域的类型
       {
          
          n=f1.elements[i].name
          t=f1.elements[i].type
          
          alert(n+" : "+t)
          
       }
    }</script></head><body ><form name="f1" method="POST" action="">
     <p>
      <input type="text" name="文本1" size="20"> </p>
     <p>
      <input type="button" name="按钮" value="1"> </p>
     <p>
      <input type="radio" name="单选框" value="r"></p>
     <p>
      <input type="checkbox" name="复选框" value="ON"></p>
     <p>
        
      <input type="submit" value="提交" name="提交"> </p>
     <p>
      <input type="reset" value="重置" name="重置"></p>
     <p>
      <input type="button" value="获得所有表单元素属性" name="B3" onclick="get_type()"></p>
     <p>
      <input type="text" name="t4" size="95"></p>
     <p>
       </p>
    </form></body></html>
      

  4.   

    还有一个关键问题呀!是怎么样在disable后,让字体是黑的呀。
      

  5.   

    是呀,没有回答正题的呀。
    还有 zhaoweiwei(轩辕大侠) 说的方法报错呀。
      

  6.   

    zhaoweiwei(轩辕大侠) 谢谢,不过要是按你的写法,确实是字体粗了,不过,多页报错,不知为什么,您试试,过后给分。
      

  7.   

    style="font-weight:900"
    readonly
      

  8.   

    <input type=text readonly>
      

  9.   

    同意们,注意是禁用,不是只读呀。而且是要用javascript的方式来控制不是直接用HTML