一个form表单有两个按钮,分别提交到不同的页面


<form action="" name="submitted" method="post">
    <input type="text" name="test"/>
    <button οnclick="test1()"/>测试1</button>
    <button οnclick="test2()"/>测试2</button>
</form>
</body>
</html>
 
<script>
    function test1(){
//        document.("表单的name值").action
//        document.("表单的name值").submit
        document.submitted.action="xxxxxxxxxxx";
        document.submitted.submit();
    }
    function test2() {
        document.submitted.action = "xxxxxxxxxxx";
        document.submitted.submit();
    }
</script>
xxxxxxxxxxx就是你要提交到哪url地址


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM