Giter Site home page Giter Site logo

kiranw06 / wats1020-dom-basics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from suwebdev/wats1020-dom-basics

0.0 2.0 0.0 763 KB

In this assignment students explore the native tools provided in Javascript to navigate and affect the DOM.

License: MIT License

JavaScript 79.17% HTML 17.37% CSS 3.46%

wats1020-dom-basics's Introduction

wats1020-dom-basics

In this assignment students explore the native tools provided in Javascript to navigate and affect the DOM. To practice these techniques, we will createa Fortune Cookie Generator page that will show you a saying like you might find in a fortune cookie.

Feel free to have fun with this, and there are lots of ways to stretch in this assignment. If done right, this could be a fun portfolio piece.

Basic Requirements

To complete the base level of this assignment, you must fulfill the following requirements:

  • Add an onclick attribute to the "Make My Fortune!" button so it executes the generateFortuneCookie() function when it is clicked.
  • In the fortune-cookie-generator.js create the logic to display a fortune:
    • Select the #fortune-cookie-text element.
    • Append the current text in the #fortune-cookie-text element as a list item (li) within the #previous-fortunes-container list.
    • Select a random fortune cookie saying from the fortunesList Array.
    • Replace the innerText of the #fortune-cookie-text element with the data you selected from fortunesList.
  • Make sure a fortune is generated each time the user clicks the button.

Stretch Goals

This assignment allows for a large number of possible stretch goals. You are encouraged to stretch in additional ways if you can think of fun/interesting things to try. Here are some ideas:

  • It's currently possible to randomly select the same fortune twice in a row. Can you think of a way to check if the new saying is the same as the previous saying and prevent it from showing up? Can you think of a way to keep track of all the sayings that have been used and prevent a saying from being repeated until the entire list has been exhausted?
  • This page is begging for some cute visuals. Use CSS to style the elements in the HTML. Feel free to add or rearrange HTML elements to fit your vision.
  • You could show additional statistics on the page, such as how many fortunes have been generated. Add those in an appealing way.
  • What if people want to generate fortunes for their whole table? Why not allow somebody to generate multiple fortunes at the same time? How would you change the code and HTML to support that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.