如何判断页面中是否含有INPUT,如果有返回true,如果没有返回false;急!!!

解决方案 »

  1.   

    if (document.getElementByTagName("INPUT"))
    {
        return true;
    }
    else
    {
       return false;
    }
      

  2.   

    我给楼上补个"s" :)
    if (document.getElementsByTagName("input"))
    {
        return true;
    }
    else
    {
       return false;
    }
      

  3.   

    function inputConfirm()
    {
        var boolen;
        var b = document.getElementsByTagName("INPUT");
        for(var i=0;i<b.length;i++)
        {
            if (b && b(i).getAttribute("name") != "__VIEWSTATE")
            {
               boolen = true;
            }
            else
            {
               boolen = false;
            }
       }
       if(boolen)
       {
        return true;
       }
       else
       {
        return false;
       }
    }
    好像每个页面都会有个隐藏的input控件。我想应该不包含这些控件
      

  4.   

    直接写就可以了,JS特定的逻辑机制
    if (document.getElementByTagName("INPUT"))
      

  5.   

    if (document.getElementByTagName("INPUT"))