function selectAll(obj)
{
var a = document.all;
for(var i=0;i<a.length;i++)
{
if(a[i].tagName=="INPUT"&&a[i].type=="checkbox"&&a[i]!=obj)
{
a[i].checked = !a[i].checked;
}
}
}//见tagName和type

解决方案 »

  1.   

    还有其他的方法吗?因为有时候得到的对象不知到是那一种对象,yong typeof 也没有用
      

  2.   

    对象 就是 对象哪来的什么html对象和javascript对象
      

  3.   

    var a;
    a就是javascript对象<input >就是html对象,
    而且有些html对象好像还没有tagName,如window对象
      

  4.   

    So in scripting languages like jscript, it's a low performance operation.Do NOT always do that.
      

  5.   

    <script language="JavaScript">
    <!--
    var a;function testobject(obj)
    { if(typeof(obj)=='object'&&typeof(obj.tagName)!='undefined')
    {
    alert('html object');
    }
    else
    {
    alert('javascirpt object');
    }}testobject(a);//-->
    </script>
      

  6.   

    to  ttyp(愿赌服输):
      我能区分html对象和javascript对象,但如何区分具体的html对象和javascript对象了
    如得到一个html object,我如何知道是window对象,frame对象,text对象,还是table对象,tr对象了?
      对javascript对象来说,如何区分是String对象,Array对象了?
      

  7.   

    function testobject(obj)
    {
    if(obj!=null&&typeof(obj)=='object'&&typeof(obj.tagName)!='undefined'&&typeof(obj.constructor)!='function')
    {
    alert('html object');
    }
    else
    {
    alert('javascirpt object');
    }
    }
      

  8.   

    typeof(obj)=='string' String对象,依次类推
    frame,text,table等HTML对象看其tagName
    window对象随便找它的一个特殊属性,看typeof是否是undefine