Crevice

handlerExercise1

Nov 6th, 2019
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. div {
  10. height: 150px;
  11. width: 550px;
  12. display: inline-block;
  13. background-color: lavender;
  14. text-align: center;
  15. }
  16. p {
  17. font-size: 3rem;
  18. width: 75%;
  19. margin: 0 auto;
  20. border: 1px solid black;
  21. }
  22. div, p {
  23. position: absolute;
  24. top: 50%;
  25. left: 50%;
  26. transform: translate(-50%,-50%);
  27. border-radius: 10px;
  28. }
  29. </style>
  30. <script>
  31. //LABEL ALL CONSOLE LOGS!!!
  32. //within these script tags:
  33. //declare a function called "handleClick", it should have one parameter named "element"
  34. //when this function is called from the HTML, it should console log the global event variable
  35. //it should also console log the "element" parameter
  36. //finally, the "handleClick" should call an alert with a string that congratulates you on your click success
  37.  
  38. </script>
  39. </head>
  40. <!--place an onload event on that body element that lets you know the body has loaded-->
  41. <body>
  42. <!--place an onclick event on the div which calls the handleClick function and pass in "this" as an argument-->
  43. <div>
  44. <p>Click on Me!!!</p>
  45. </div>
  46.  
  47. </body>
  48. </html>
  49. <!--For a bonus challenge, incorporate more Dom events into your HTML, add elements, add functions to your
  50. script tags, have fun! -->
Add Comment
Please, Sign In to add comment