Jump to content

Can Anyone Help Me?


ChidoriSoul

Recommended Posts

Is there anyway in Javascript that I can make a Random Number Generator that if you push submit, instead of going to an entirely different page, it just does the same page, and if you land on the correct number, an alert pops up saying you won. Example:Click, page does not change, just the search button moves. Err, this is kinda hard to explain, so I will try my best.You click, nothing happens except the submit buttons moves to 1 of 3 places on the page, like in a <td> of a table. Then, if you run across the correct number, a pop up says that you have found the correct answer, and the page changes to where you win.Anyone know of a code like that, with just pure Javascript, no PHP.

Link to comment
Share on other sites

The following returns a random integer from 0 to n - 1Math.floor(Math.random() * n)This returns a random integer from 1 to nMath.ceil(Math.random() * n)For the rest, I suggest you look into the location object (for the redirect) and some DOM techniques, like innerHTML, insertBefore(), and appendChild().

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...