Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. </head>
  2. <body>
  3. <input type="button" id="btnSearchPhrase" value="Random Phrase"onclick="randomPhrase();" />
  4. <div id="phrase" ></div>
  5.  
  6. <input type="button" class="btnSearchNoun" value="Random Noun" onclick="randomNoun();" />
  7. <div id="noun" ></div>
  8.  
  9. <script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.2/velocity.min.js"></script>
  10. <script src="js/main.js"></script>
  11.  
  12. </body>
  13. </html>
  14.  
  15. var phrases = ["You will soon find happiness in", "The answer is most definitely",
  16. "There is much danger in your future because of", "Your role model for the week should be"];
  17.  
  18. var nouns = ["red", "weevils", "a bale of hay", "math class"];
  19.  
  20. var randPhrases = phrases[Math.floor(Math.random() * phrases.length)];
  21.  
  22. var randNouns = nouns[Math.floor(Math.random() * nouns.length)];
  23.  
  24.  
  25.  
  26.  
  27. function randomPhrase() {
  28.  
  29. randPhrases = phrases[Math.floor(Math.random() * phrases.length)];
  30.  
  31. document.getElementById("phrase").innerHTML=randPhrases;
  32. }
  33.  
  34. function randomNoun() {
  35.  
  36. randNouns = nouns[Math.floor(Math.random() * nouns.length)];
  37.  
  38. document.getElementById("noun").innerHTML = randNouns;
  39. }
  40.  
  41. randPhrases.addEventListener("click", clickPhrase);
  42.  
  43. function clickPhrase(event) {
  44. Velocity(event.target, { paddingTop: "25px" }, { duration: 100 });
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement