随机链接
- <!DOCTYPE html>
- <html>
- <body>
- <p id="demo"></p>
- <script>
- if (Math.random() < 0.5) {
- text = "<a href='https://baidu.com'>访问 baidu</a>";
- } else {
- text = "<a href='https://wwf.org'>访问 WWF</a>";
- }
- document.getElementById("demo").innerHTML = text;
- </script>
- </body>
- </html>