js总结(11)一个页面同时提交多个form表单的实施

Posted nice2018

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js总结(11)一个页面同时提交多个form表单的实施相关的知识,希望对你有一定的参考价值。

父页面的代码

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Index</title>
       <script src="js/jquery-1.9.min.js"></script>
    </head>
    <body>
        <iframe src="form.php" width="800px" height="600px"></iframe>
        <iframe src="form.php" width="800px" height="600px"></iframe>
        <iframe src="form.php" width="800px" height="600px"></iframe>
        <iframe src="form.php" width="800px" height="600px"></iframe>
        <iframe src="form.php" width="800px" height="600px"></iframe>
        <iframe src="form.php" width="800px" height="600px"></iframe>
        <button>aa</button>
    </body>
     <script type="text/javascript">
            function submitAll()
                var ifms = document.getElementsByTagName(‘iframe‘);
                for (var i = 0; i < ifms.length; i++) 
                    var win = (ifms[i].contentWindow || ifms[i]);
                    win.submitMe();
                
            
  $("button").click(
  	function () 
  	submitAll()
  	)
        </script>
</html>

  form表单的页面

 <script type="text/javascript">
            function submitMe()
                document.getElementById(‘testForm‘).submit();
            
            function submitAll()
                window.parent.submitAll();
            
        </script>

  

 

以上是关于js总结(11)一个页面同时提交多个form表单的实施的主要内容,如果未能解决你的问题,请参考以下文章