Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. ##Number Guesser readme##
  2.  
  3. #####HTML#####
  4.  
  5. During the building of the Number Guesser the first thing that was taken into account was the HTML structure.
  6. Reviewing the provided comp in a "top to bottom" approach, it was determined the the header would include the ``<h1>`` for the header titling the game.
  7. The ``<main>`` section would follow the header and also be contained within the body and hold the interactive portion of the game.
  8. Noted in the ``<main>`` section all the information and elements are aligned in the center in what appears to be a uniform section.
  9. This section contains the interactive input field, "Guess" and "Clear" buttons ``<button>, an information display including the last guessed number and a "Reset" ``<button>``.
  10. While building the structure of the HTML, I.D.'s and classes were assigned to the elements for later use in CSS styling and in Javascript.
  11.  
  12. #####CSS#####
  13.  
  14. After completing the initial structure of HTML the comp was again reviewed to determine the styling of the page.
  15. First the provided color information was assigned to the respective elements as noted in the comp.
  16. - Header Background Color #404041
  17. - H1 "Number" #ED458B, "Guesser" #E6E7E8
  18. BUTTONS
  19. - Background Color #929497, Text #FFFFFF
  20. - Disabled State : Background Color #D0D2D3, Text #FFFFFF
  21. - Hover: Background Color #EB008B, Text #FFFFFF
  22. FEEDBACK
  23. - info feedback area: Feedback #404041, Number Text #EB008B
  24.  
  25. The ``<h1>`` and ``<p>`` tags were then assigned to the provided font-family:'Open Sans', sans-serif. Each element font-size was
  26. evaluated and adjusted based on relationships to other elements on comp within proportion.
  27.  
  28. #####CSS attributes#####
  29. border-radius:
  30. width:
  31. height:
  32. color:
  33. margin:
  34. font-family:
  35. font-weight:
  36. font-size:
  37. background-color:
  38. decoration:
  39.  
  40. Noted: ``<button>`` attributes order need to adjust after javascript inorder to function properly.
  41.  
  42. #####JavaScript#####
  43.  
  44. upon workup of HTML and CSS, Java script was incorporated based on functionality of page. First, define global variables for use in later function:
  45. var guessButton = document.getElementById('guessButton');
  46. var clearButton = document.getElementById('clearButton');
  47. var resetButton = document.getElementById('resetButton');
  48. var randomNumber;
  49. var userState = document.getElementById('userState');
  50. var zeroState = document.getElementById('zeroState');
  51. var lastGuessMessage
  52. Variables use "I.D." to better determine usage.
  53.  
  54. "top to bottom" approach used again based on structure of HTML.
  55. The next step, determine clickable buttons and relations to action of page.
  56. -guessButton- used to submit guess
  57. -clearButton- used to clear out inut field of last guess and attempt another guess.
  58. -resetButton- used to clear contents of input field and last guess number and start over
  59.  
  60. Create a function list to incorporate the variables into a function associated with each button.
  61. Console. log was added to functions inorder to test actions while building page.
  62. -function clearInput() clears input field
  63. -function clearZero() clears last guess return
  64. -function disableButton() used to disable button until input field is complete
  65. -function unDisableButton() used to enable button once input complete
  66. -function clearLastGuessMessage() clears message return
  67. -function clearUserState() clears result
  68. -function getRandomNumber() will assign number on load and reset
  69. -function evaluateGuess() compares random number to user guess
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement