CSC 223 — Authoring for the Web

Random Customer Testimonial

Overview

In this assignment you'll use JavaScript to create a list of customer testimonials and display a random one on the page every time it loads.

Example Testimonial

Assignment

  1. Create a new javascript file.

  2. Correctly link that file to your Portfolio page using a <script> tag.

  3. Add an empty <div> tag to the bottom of the html page with a unique id.

  4. In your JavaScript file, create an array of customer testimonials. Your testimonials must include quotation marks.

  5. Create a separate function containing the necessary code to generate a random number between 0 and one less than the length of your array. (see below for a hint on creating random numbers in JavaScript)

  6. Write the necessary code to call the function you created in step 5, then use that random number to selet a random testimonial from the array and place its text into the div you created in step 3.

  7. Make sure your testimonial div is correctly styled with CSS to make it easily visible.

  8. Update the table of contents link on your index page if necessary.

  9. Submit the url to your github pages site to MySVU. (This should be something like https://USERNAME.github.io/REPOSITORYNAME).

Hints

var message = '"This is a quote..."';