function func3(){ var userId =document.getElementById("text1").value; var userName =document.getElementById("text2").value; //js方法; location.href="http://175.3.15.2:8380/MyFirstWeb/index.jsp?userId="+userId+"&"+"userName"+userName; } <!--<form action="http://175.3.15.2:8380/MyFirstWeb/index.jsp" method="get">--> //url提交方式 <a href="#" onclick="func3()">ok</a> <input type="button" name="btn1" id="btn1" value="冒泡方式" /> <input type="button" name="btn2" id="btn2" value="blingbling" /> <input type="text" name="text1" id="text1" placeholder="come on" /><br /> <input type="text" name="text2" id="text2" placeholder="come on" /><br /> <input type="submit" name="sub" id="sub" value="commit" onclick="func3()"/> <!--</form>-->