遍历所有链接都在新窗口打开

  1. <script>  
  2. function openBlank(){   
  3.   var aa=document.getElementsByTagName("a");   
  4.   for (var i=0;i<aa.length;i++){   
  5.     aa[i].target='_blank';   
  6.   }   
  7. }   
  8. if (document.all){   
  9.   window.attachEvent('onload',openBlank);   
  10. }   
  11. else{   
  12.   window.addEventListener('load',openBlank,false);   
  13. }   
  14. </script>  
  15.   
  16. <title>遍历所有链接都在新窗口打开</title>  
  17. <body>  
  18. <a href="http://www.baidu.com">baidu</a><br/>  
  19. <a href="http://www.showyounger.com">showyounger</a><br/>  
  20. <a href="http://www.qq.com">qq</a><br/>  
  21. </body>  
  1. da shang
    donate-alipay
               donate-weixin weixinpay

发表评论↓↓