简体   繁体   中英

How can i open same link 10 time in 10 tab by just clicking on button

How can I open the same link 10 times in 10 tabs by just clicking on button?

Is php required to do this and if so can you provide a code sample?

Below is an example of my code:

 <html> <body> <script language="javascript"> function kishan() { window.open('http://stackoverflow.com','_blank'); } </script> <input type="button" value="ok" onclick="kishan()"> </body> </html> 

只需将多个window.open添加到您的代码中,或遍历10次

Inside your function add a loop as follows:

function kishan()
{
 for(i=0; i<10; i++){
     window.open('http://stackoverflow.com','_blank');
  }
 }

Make sure this is not a spam though!

You can do it this way,

 <html> <body> <script language="javascript"> function open_10_tab() { for (var i = 0; i < 10; i++) { window.open('http://stackoverflow.com', '_blank'); } } </script> <form> <input type=button value="Open Windows" onclick="open_10_tab()"> </form> </body> </html> </html> 

I Find my answer. just create a function that calls open() and call that function multiple time in loop or any where you want. just allow browser to not block pop-up ads.

 <html>
<body>
<script language="javascript">
    function kishan(){

       for(i=0;i<=10;i++){
      open()
          }

    }
        function open() {
           window.open('http://stackoverflow.com','_blank');
        }
</script>
<input type="button" value="ok" onclick="kishan()">
</body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM