o = document.getElemnetsByTagName("INPUT")
for(i=0;i<o.length;i++)
{
if(o[i].type=="textbox") alert(o[i].value)
}

解决方案 »

  1.   

    <html>
    <head>
    <script language="javascript">
    function CheckEmpty()
    {
    var oText=window.Form2.getElementsByTagName("input");
    alert(oText.length);

    for(var i=0;i<oText.length;i++)
    {
    if(oText[i].type=="text" && oText[i].value=="")
    {
    alert(oText[i].name);
    }
    }
    }
    </script></head>
    <body>
    <form id="Form2"> <input type="text" name="f1" id="f1">
    <input type="text" name="f2" id="f2">
    <input type="text" name="f2" id="f3">

    <input type="button" id="button1" value="go" onclick="CheckEmpty();">
    </form>
    </body>
    </html>
      

  2.   

    o = document.getElementsByTagName("INPUT")
    for(i=0;i<o.length;i++)
    {
    if(o[i].type=="textbox") alert(o[i].value)
    }
      

  3.   

    for(var i=0;i<document.all.length;i++)
    {
      if(document.all(i).type=='text') alert(document.all(i).value);
    }