php结合js实现表单提交给多个页面的方法

时间:2016-05-15
php提交表单是网站开发中经常遇到的,也是最基本的表单提交,但如何实现表单同时提交给多个页面呢?本文章向码农介绍php结合js实现表单提交给多个页面的方法,感兴趣的码农可以参考一下。

下面代码就可以实现了将一个表单提交给多个页面,这种方法可以提交给多少页面都可以的哦。

<script language="javascript">
      function _submit(){
            document.form1.action = "http://www.google.com";
            document.form1.method = "get"; //post
            document.form1.target = "_blank"; //_self //_parent //_top
            document.form1.submit();

            document.form1.action = "http://www.baidu.com";
            document.form1.method = "get"; //post
            document.form1.target = "_blank";//_self //_parent //_top
            document.form1.submit();
      }
 </script>

<form name="form1">
      <input type="button" value="提交" onclick="_submit()">
 </form>

以上是本文的全部类容,希望码农喜欢。