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

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -