输入的时候就变?
还有没有其他的 INPUT 呢.var jsInput=document.getElementById("js");
jsInput.value=0;
var allInput=document.getElementsByTagName("INPUT");
for(var i=0;i<allInput.length;i++)
{
if(allInput[i].name!="js")
{
allInput[i].onchange=function(){
if(allInput[i].value!="")
{
jsInput.value++;
}
}
}
}
还有没有其他的 INPUT 呢.var jsInput=document.getElementById("js");
jsInput.value=0;
var allInput=document.getElementsByTagName("INPUT");
for(var i=0;i<allInput.length;i++)
{
if(allInput[i].name!="js")
{
allInput[i].onchange=function(){
if(allInput[i].value!="")
{
jsInput.value++;
}
}
}
}
还有没有其他的 INPUT 呢.var jsInput=document.getElementById("js");
jsInput.value=0;
var allInput=document.getElementsByTagName("INPUT");
for(var i=0;i<allInput.length;i++)
{
if(allInput[i].name!="js")
{
allInput[i].onchange=function(){
if(allInput[i].value!="")
{
jsInput.value++;
}
}
}
}
function aa(n)
{
var count = 0;for(i=1;i<=n;i++)
{
if(document.getElementById("a"+i).value !="")
{
count += 1;
}
}
document.getElementById("js").value = count;}
</script>
<form id="form1" name="form1" method="post" action="">
<input type="text" name="a1" id="a1" onBlur="aa(1)" />
<input type="text" name="a2" id="a2" onBlur="aa(2)" />
<input type="text" name="a3" id="a3" onBlur="aa(3)" />
<input type="text" name="a4" id="a4" onBlur="aa(4)" />
<input type="text" name="a5" id="a5" onBlur="aa(5)" />
<input type="text" name="a6" id="a6" onBlur="aa(6)" />
<input type="text" name="js" id="js" />
</form>
function aa(n)
{
var count = 0; for(i=1;i <=6;i++)
{
if(document.getElementById("a"+i).value !="")
{
count += 1;
}
}
document.getElementById("js").value = count; }
</script>