php js 批量打开页面
生活随笔
收集整理的這篇文章主要介紹了
php js 批量打开页面
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
獲取網址中的url
//瀏覽器console中加入jquery方便調試 var jquery = document.createElement('script'); jquery.src = "http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js";//若調試頁面是https的這里也修改為https. document.getElementsByTagName('head')[0].appendChild(jquery); jQuery.noConflict(); //獲取超鏈接中的網址 $('#idtab a').each(function(){var href = $(this).attr('href');console.log(href); });?php文件:?
<!DOCTYPE html> <html> <head><title></title> </head> <!-- 引入jq --> <script src="https://ajax.microsoft.com/ajax/jquery/jquery-1.4.min.js"></script> <body> <?php //要打開的網址 $sUrl = 'https://www.baidu.com,https://www.baidu.com'; $aUrl = explode(',', $sUrl); $sJosnUrl = json_encode($aUrl); ?><script type="text/javascript">//休眠函數 毫秒function sleep(n) {var start = new Date().getTime();while (true) {if (new Date().getTime() - start > n) {break;}}}var i = <?php echo $sJosnUrl; ?>;$.each(i, function (index, value) {window.open(value);sleep(3000); //3000毫秒打開一個}) </script></body> </html>?
總結
以上是生活随笔為你收集整理的php js 批量打开页面的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 不等双11,立减¥3554!戴尔官网撩客
- 下一篇: php开发的支付宝、微信个人免签支付接口