Create a folder, "JS1"
Create files called js1.htm, js1.css, js1.js
Link the files appropriately
The page should have 2 vertical, different-colored, side-by-side divs.
Use getElementById to find the proper html element and innerHTML to output in the left (fizzbuzz).
Use an array (store the numbers) and document.write to output in the right (fibbonaci).
LEFT
A paragraph with a single word, FizzBuzz, followed by a description of the
function, that when clicked will invoke a function, FizzBuzz, that will:
- Prompt and ask the user for a number, n (max 30, default 20).
- Generate the numbers 1-n in a loop.
- If a number is divisible by 3 & 5, output 'FizzBuzz' white on red.
- If a number is divisible by 3, output 'Fizz' black on yellow background.
- If a number is divisible by 5, output 'Buzz' white on black.
- Otherwise simply print the number in black on white.
- Use getElementById and innerHTML
RIGHT
A paragraph with a single word, Fibonacci, followed by a description of the
function, that when clicked will invoke a function, Fibonacci, that will:
- Use prompt to ask the user for a number, n (max 30, default 20).
- Compute the first n Fibonacci numbers starting with the pair, 0 and 1.
- Prompt and ask the user for a number, n (max 30, default 20).
- After filling the array, print the contents of the array so that each number
is printed to a line with even numbers black on yellow and odd numbers
white on black.
- Use document.write() to output