代码示例:(标识:eg_js_randomlink)
<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
if (Math.random() < 0.5) {
  text = "<a href='https://sou-xun.com'>访问 (www.sou-xun.com)</a>";
} else {
  text = "<a href='https://wwf.org'>访问 WWF</a>";
}
document.getElementById("demo").innerHTML = text;
</script>

</body>
</html>
运行结果: