Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.79 KB | None | 0 0
  1. <html>
  2.     <head>
  3.         <title>Lucile's button page</title>
  4.     </head>
  5.     <body>
  6.  
  7.         <button id="click-me-button">click me!</button>
  8.  
  9.         <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  10.         <script>
  11.  
  12.             var wordList = [
  13.                 'baguette',
  14.                 'vin',
  15.                 'lucile',
  16.                 'vive la france',
  17.                 'mischa',
  18.                 'croissant'
  19.             ];
  20.  
  21.             $('#click-me-button').click(function() {
  22.  
  23.                 var buttonLength = wordList.length;
  24.                 var randomNumber =  Math.floor((Math.random() * buttonLength));
  25.  
  26.                 alert('le word of choice is: '+wordList[randomNumber]);
  27.  
  28.             });
  29.         </script>
  30.     </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement