解决方案 »

  1.   


    <body>
    <form name="form1" method="post" action="myb.jsp">
    <input type="button" name="1" id="1" value="1" onclick="getvalue(this,'h1')"/>
    <input type="button" name="2" id="2" value="2" onclick="getvalue(this,'h2')"/>
    <input type="button" name="2" id="3" value="3" onclick="getvalue(this,'h3')"/>
    <input type="submit" name="=" id="="/>
    <input type="hidden" name="h1" id="h1" value="4"/>
    <input type="hidden" name="h2" id="h2" value="5"/>
    <input type="hidden" name="h3" id="h3" value="6"/><script>
    function getvalue(btn,h){
    document.getElementById(h).value=btn.value;
    alert(document.getElementById(h).value);
    }
    </script>
    </form>
    </body>稍微改了下,纯js的,JS熟悉了可以学学jquery,比较流行
      

  2.   


    <body>
    <form name="form1" method="post" action="myb.jsp">
    <input type="button" name="1" id="1" value="1" onclick="getvalue(this,'h1')"/>
    <input type="button" name="2" id="2" value="2" onclick="getvalue(this,'h2')"/>
    <input type="button" name="2" id="3" value="3" onclick="getvalue(this,'h3')"/>
    <input type="submit" name="=" id="="/>
    <input type="hidden" name="h1" id="h1" value="4"/>
    <input type="hidden" name="h2" id="h2" value="5"/>
    <input type="hidden" name="h3" id="h3" value="6"/><script>
    var count=1;
    function getvalue(btn){
    document.getElementById("h"+count).value=btn.value;

    alert(document.getElementById("h"+count).value);
    count++;
    if(count==4){
    count=1;
    }
    }
    </script>
    </form>
    </body>好像明白你要的效果了,改了下,如果点了3次后又重新从第1次开始,看看是不是这样
      

  3.   

    总体思路就是用javascript,先获取到form,在获取到form里面的button,在获取到button上面的按钮,javascript获取页面值这样的思路最基础,还有就是使用id或者name,多试试就ok了,祝福你,