1. naming those inputs with indexes
2. if those inputs are very regular, use element.sourceIndex to figure out the index
3. enumerate through all inputs and figure out the index

解决方案 »

  1.   

    for(i=0;i <form1.input.length;i++)
    {
    if (form1.input[i] == document.activeElement) 
            {
    alert(form1.input[i].value);
    return true;        } 
    }
      

  2.   

    <form>
    <input onfocus=show(this)>
    <input onfocus=show(this)>
    <input onfocus=show(this)>
    <input onfocus=show(this)>
    </form>
    <script>function show(e){window.status=e.sourceIndex-e.parentElement.sourceIndex}</script>