Global Variable Go to the jpf_hitori.js file in your editor. Directly below the comment section, declare the global allCells variable, which you will use to store an array of the puzzle cells in the...


Global Variable


Go to thejpf_hitori.js file in your editor. Directly below the comment section, declare the global allCells variable, which you will use to store an array of the puzzle cells in the Hitori table. Do not define a value for the variable yet.


JavaScript Functions


Insert a command to run the startUp() function when the page is loaded by the browser. Add the startUp() function, which displays the contents of Puzzle 1 after the page is loaded and sets up the initial event handlers. Within the function, add the following commands:




  1. Change the inner HTML of the element with the ID, “puzzleTitle” to the text “Puzzle 1”.




  2. Call the drawHitori() function using the hitori1Numbers, hitori1Blocks, and hitori1Rating variables as parameter values and store the HTML code returned by the function in the inner HTML of the page element with the ID “puzzle”.




  3. Declare a variable named puzzleButtons referencing the page elements with the class name “puzzles”. Loop through the puzzleButtons object collection and for each button add an event handler that runs the switchPuzzle() function when the button is clicked.




  4. Call the setupPuzzle() function that defines the initial appearance of the first puzzle.




  5. Add an event handler to the
    Check Solutions
     button to run the findErrors() function when clicked.




  6. Add an event handler to the
    Show Solutions
     button to run the showSolution() function when clicked.





Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here