JS动态修改a链接href的url(每次点击进入的链接都不一样)

我比较开门见山 上代码!!!!

 <script language="javascript">

                url = new Array();
                url[0] = "https://line.me/ti/p/ZbQiRBLgpq";
                url[1] = "https://line.me/ti/p/EqUFJX5IUg";
                url[2] = "https://line.me/ti/p/P07Aeqidae";
                url[3] = "https://line.me/ti/p/8YQyTRz98D";
                i = Math.random() * url.length;
                i = Math.floor(i);
                str = "<a id='linkID' href='" + url[i] + "'>";

              </script>
              </head>
              <body>
              <script language="javascript">
                document.write(str + "<img src='https://tw.chufeiyan.com/wp-content/uploads/2016/01/qwqwq.gif'></a><br>");

              </script>

为您推荐

评论已关闭