html - Go to random page in Javascript -


I want to program a button with a button, when I press it, one of the pages (from the list Javascript code should be opened randomly How do I do this? Thanks a lot!

OK, let's see.

  • Math.Random () , which will give you a random number between 0 (inclusive) and 1 (exclusive)

  • window.location , a property that you specify the URL to take to the browser on a new page

  • Array, which can contain a string, which is a URL

    Put them together, and you have The ability is to select a URL at random (using the Math.random , from the array) and to go there Aujhr tell.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -