Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- </head>
- <body>
- <input type="button" id="btnSearchPhrase" value="Random Phrase"onclick="randomPhrase();" />
- <div id="phrase" ></div>
- <input type="button" class="btnSearchNoun" value="Random Noun" onclick="randomNoun();" />
- <div id="noun" ></div>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.2/velocity.min.js"></script>
- <script src="js/main.js"></script>
- </body>
- </html>
- var phrases = ["You will soon find happiness in", "The answer is most definitely",
- "There is much danger in your future because of", "Your role model for the week should be"];
- var nouns = ["red", "weevils", "a bale of hay", "math class"];
- var randPhrases = phrases[Math.floor(Math.random() * phrases.length)];
- var randNouns = nouns[Math.floor(Math.random() * nouns.length)];
- function randomPhrase() {
- randPhrases = phrases[Math.floor(Math.random() * phrases.length)];
- document.getElementById("phrase").innerHTML=randPhrases;
- }
- function randomNoun() {
- randNouns = nouns[Math.floor(Math.random() * nouns.length)];
- document.getElementById("noun").innerHTML = randNouns;
- }
- randPhrases.addEventListener("click", clickPhrase);
- function clickPhrase(event) {
- Velocity(event.target, { paddingTop: "25px" }, { duration: 100 });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement