zoukankan      html  css  js  c++  java
  • JS取得不同连接的地址,并打开新窗口

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
      <title>Example</title>
    <script type="text/JavaScript">
    window.onload = function() {
      if (!document.getElementsByTagName) return false;
      var lnks = document.getElementsByTagName("a");
      for (var i=0; i<lnks.length; i++) {
        if (lnks[i].getAttribute("class") == "popup") {
          lnks[i].onclick = function() {
            popUp(this.getAttribute("href"));
            return false;
          }
        }
      }
    }
    
    function popUp(winURL) {
      window.open(winURL,"popup","width=320,height=480");
    }
    
    </script>
    </head>
    <body>
    <a href="http://www.example.com/" class="popup">Example</a>
    </body>
    </html>
  • 相关阅读:
    【概念】指针
    【c++】随机数
    组装一台计算机
    模拟打印机
    实现手机的某些功能
    作业
    static 静态内部类
    java中编译报错 ClassCastException 是什么原因,如何处理
    作业1 2
    作业2
  • 原文地址:https://www.cnblogs.com/findumars/p/3164228.html
Copyright © 2011-2022 走看看