A Pen by VenomSnake on CodePen.
          Created
          December 2, 2017 11:46 
        
      - 
      
 - 
        
Save HuangStanley050/3b65f3e33a2ee6b90b6c23ea0c3cce29 to your computer and use it in GitHub Desktop.  
    Random Quote page
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <head> | |
| <title>Random Quote generator</title> | |
| </head> | |
| <body> | |
| <h1>This site generate a random quote</h1> | |
| <br> | |
| <br> | |
| <input type="button" class="button" onclick="upDate_quote()" value="Generate"> | |
| <input type="button" class="button" value="Tweet" onclick="sendToTweet()"> | |
| <div id="test" class="center"> | |
| <h2>This is the place where quote will show</h2> | |
| </div> | |
| </body> | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var quotes = new Object(); | |
| quotes["1"] = "If you sit back & spend too much time feeling good about what you did in the past, you're going to come up short next time ~ Bill Belichick"; | |
| quotes["2"] = "Talent sets the floor, character sets the ceiling ~ Bill Belichick"; | |
| quotes["3"] = "I can accept failure, everyone fails at something. But I can't accept not trying ~Michael Jordan"; | |
| quotes["4"] = "I can accept failure, everyone fails at something. But I can't accept not trying ~Tom Brady"; | |
| quotes["5"] = "You're better than you look. Try harder. ~Ken Masters"; | |
| var quote_id; | |
| var str_head="<h2>"; | |
| var str_end="</h2>"; | |
| var exp=""; | |
| function upDate_quote() { | |
| quote_id = Math.floor(Math.random() * 5) + 1; | |
| exp = quotes[quote_id]; | |
| document.getElementById("test").innerHTML= str_head+exp+str_end; | |
| } | |
| function sendToTweet() { | |
| window.open('https://twitter.com/intent/tweet?hashtags= freecodecamp&text=' + encodeURIComponent(exp)); | |
| } | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | h1 { | |
| font-family: arial; | |
| font-style: italic; | |
| } | |
| h2 { | |
| font-family: courier; | |
| } | |
| body { | |
| background-color: lightblue; | |
| } | |
| .button { | |
| background-color: blue; /* Green */ | |
| border: none; | |
| color: white; | |
| padding: 15px 32px; | |
| text-align: center; | |
| text-decoration: none; | |
| display: inline-block; | |
| font-size: 20px; | |
| cursor: pointer; | |
| } | |
| .button:active { | |
| transform: translateY(5px); | |
| } | |
| .center{ | |
| position:absolute; | |
| height: X px; | |
| width: Y px; | |
| left:50%; | |
| top:50%; | |
| margin-top:- X/2 px; | |
| margin-left:- Y/2 px; | |
| } | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment