Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.44 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. .button {
  6.   background-color: #4CAF50;
  7.   border: none;
  8.   color: white;
  9.   padding: 15px 32px;
  10.   text-align: center;
  11.   text-decoration: none;
  12.   display: inline-block;
  13.   font-size: 16px;
  14.   margin: 4px 2px;
  15.   cursor: pointer;
  16. }
  17. </style>
  18. </head>
  19.     <body>
  20.         <div style="background-color:#4CAF50">
  21.         <center><h1>Taco Time!</h1></center>
  22.         </div>
  23.          
  24.         <div style="background-color:lightblue">
  25.         <center><button class="button" onclick="document.getElementById('myImage').src='Images/taco.png'">Fill Taco</button>
  26.         <img id="myImage" src="Images/taco shell.png" style="width:250px" "height:250px">
  27.         <button class="button" onclick="document.getElementById('myImage').src='Images/taco shell.png'">Empty Taco</button></center>
  28.          
  29.          
  30.         <center><img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="Images/sizetaco.png" alt="tacoSize" style=margin-top:80px width="75" height="75"></center>
  31.         <center><h3>Help me grow by hovering over me! </h3></center>
  32.  
  33.         <center><img id="tacoLine" src="Images/tacoline10.png" style=margin-top:80px style="width:250px" "height:250px"></center>
  34.         <center><button class="button" onclick="buttonCounter()">Eat Taco</button></center>
  35.          
  36.         <center><h3> Here are some tacos for you, we only have 10 though. </h3></center>
  37.  
  38.         <script>
  39.             var tacosEaten = 0;
  40.  
  41.             function buttonCounter(){
  42.                 if (tacosEaten < 10){
  43.                   tacosEaten++;
  44.                   var pathToImage = "Images/tacoline" + (10 - tacosEaten) + ".png";
  45.                   document.getElementById('output').innerHTML = "You have eaten " + tacosEaten + " tacos!";
  46.                   document.getElementById('tacoLine').src = pathToImage;
  47.               } else {
  48.                   document.getElementById('output').innerHTML = "There are no more tacos!";
  49.                   document.getElementById('tacoLine').src = "Images/tacoline0.png";
  50.               }
  51.              
  52.          }
  53.  
  54.          function bigImg(x) {
  55.              x.style.height = "150px";
  56.              x.style.width = "150px";
  57.          }
  58.  
  59.          function normalImg(x) {
  60.              x.style.height = "75px";
  61.              x.style.width = "75px";
  62.          }
  63.  
  64.      </script>
  65.    
  66.         <center><h3 id="output"></h3></center>
  67.     </div>
  68.     </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement