<input type=checkbox id=chk1>
<button onclick="alert(chk1.checked)">Get</button>

解决方案 »

  1.   

    <input type=checkbox id=chk1>
    <script>
    document.body.onmouseup = check;
    function check(){
      alert(document.activeElement==chk1);
    }
    </script>
      

  2.   

    能不能只判断元件的类型?比如判断是否为text?
      

  3.   

    <input type=text id=chk1>
    <input type=checkbox>
    <script>
    document.body.onmouseup = check;
    function check(){
      alert(document.activeElement==chk1&&document.activeElement.type=='text');
    }
    </script>
      

  4.   

    <input type=type name=t1>
    var len=document.formName.elements.length
    var num=0
    for(var i=0;i<len;i++)
    {
       if(document.formName.elements[i].type=="text")
        {
          num++
        }
    }
    alert(num)  //text数量
      

  5.   

    可以
    obj.type例如:
    <input type=text value="" onclick="javascript:alert(this.type)">单击就会弹出“text”
      

  6.   

    thanks all very much