search

Home  >  Q&A  >  body text

javascript - How to implement random jumps to multiple domain names?

1. How to implement random jumps to multiple domain names? Can the same link point to a random domain name?
2. For example, link a jumps to link b this time. Next time, it may be link c. The jump link is random. How to implement this in the code?

迷茫迷茫2755 days ago1094

reply all(2)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-06-12 09:22:52

    Is this okay?

    location.href = Math.random() < 0.5 ? "http://www.foo.com" : "http://www.bar.com";
    

    reply
    0
  • 代言

    代言2017-06-12 09:22:52

    loaction.href = 'xxx.com/xxx'+Math.random();

    reply
    0
  • Cancelreply