1
Answer

Display Random numbers

I have 8 buttons it should display each button with any value from 1 to 8
After selecting any one button again the button should display random value from 1 ot 8.
Help me in this regards
Thank you.
Answers (1)
2
Manav Pandya

Manav Pandya

NA 7.1k 24k 7y
Hello
 
You can achive this one easily using javascript as follow :
 
  1. function GetRandom() {  
  2.     var randomnum = Math.floor((Math.random() * 8) + 1);  
  3.    document.Write("Random Number Is :-"+x)  
  4. }  
  5.   
  6. // And Call Function in button click event  
  7.   
  8. <button onclick="GetRandom()">Click Me</button>  
  9.   
  10. // Output will be random value between 1 to 8  
I hope it will be useful to you
 
Thanks