Try:
<html>
<head>
<script language=javascript>
function mm()
{
    var coll = document.all.tags("INPUT");
    //因为coll集合包含下面<input type=button ..>一项
    //所以下面 i < coll.length-1 而不是i < coll.length
    for(var i = 0; i < coll.length-1; i++)
    {
if(coll[i].value == "")
    alert(i + 1 +"不能为空!");
     else
    document.form1.submit();
    }
}
</script>
</head>
<body>
<form name=form1  method=post action="aaa.asp">
1:<input type=text><br>
2:<input type=text><br>
3:<input type=text><br>
4:<input type=text><br>
5:<input type=text><br>
<input type=button onclick='mm()' value="Click me to submit">
</form>
</body>
</html>