What is Web II?
Javascript with the DOM is my focus.
My Web 1 class is 1 semester and is strictly HTML, CSS, and Design Principles
My Web 2 class is 1 semester and is Building Web Apps using Javascript and the DOM.
Most Javascript courses I've seen teach the Javascript language and have very little to do with changing/manipulating the web page in useful/meaningful ways, so I changed my javascript approach to focus on applying Javascript towards building simple/useful web apps.
The focus isn't on creating fully fledged, multi-page websites, but on simplifying something down to a single-use app (like a calculator, or a guessing game, or a stopwatch) and figuring out how to mock that up using web tools (html and css) and then make it function using JS.Â
Course Focus
My approach focuses on the following:
Javascript/DOM fundamentals
Basics of Javascript variables
Reference elements on an HTML page using document.getElementByID
AddEventListener on buttons, divs, or inputs for "click" or "keyup"
Pull content from input elements using .value
Put content into the page using .innerHTML
Convert #'d input into numbers
Random #'s & ConditionalsÂ
Timers
Additional Topics, Time Permitting
Loops - because in the apps listed above, you don't really need them. EventListeners and Timers kind of take the need to learn loops out unless you're trying to repeat a command multiple times at once (like initializing a bunch of values or dynamically adding multiple items to the page).
Cookies/Session data - a little more complicated, these involve browser data storage - ToDo Lists, Flash Cards, Remember the user's name so they don't have to type it again.
Canvas - a really useful tool that allows students to build visually appealing games (rather than simple input/output programs").
CSS Tricks - CSS Flexbox Guide
Youtube - Free Webhosting with GitHub Pages
Aspirations in Computing Award (for women, genderqueer, or non-binary students with strong interests in computer technology)
CSS
Bootstrap - Official Bootstrap Website (check out their Examples page - especially the cheatsheet page)
Flexbox W3Schools - Very short summary of Flexbox (row & column positioning tool, better than float for column layouts)
Flexbox Layout Guide - Resource for all the flexbox properties (plus visuals)
Responsive Design
MattKersley - Responsive Design Test - Quick look on how your site looks on multiple devices.
ResponsiveTestTool.com - Switch between different devices to test the look of your site.
Comedy Sketch - The Expert
The following materials are the lessons & Cheatsheets from the Willamette Promise College Credit course. I'm not offering college credit for this course, But the resources are here for your perusal.
Assignment (First graded thing):
Using the slides in the 2 dropdown immediately following this, complete the following tasks:
Build a simple web page using HTML & CSS.
Do this in vscodeedu.com (not on the desktop vscode)
Students should create a new HTML project, not continue with Web1's. I'd suggest calling this project "Web2"
Topic: If Mr. Birkel were an animal, what would it be
All HTML tags must be used correctly and the content must validate their reasoning as to what animal Mr. Birkel would be.
All content must be school appropriate.
Students must demonstrate every HTML element addressed in the 1st HTML Presentations.Â
Students must demonstrate the following from the 2nd HTML presentation
Basics of adding an image (including alt tags)
Adding a simple, small table (between 3-6 rows & columns)
Adding a few form elements, (pick and choose)
Assign classes to multiple items (shared name) and id's to 1 or more items (unique names)
div tag
anchor tag (though it should be to some existing webpage, not to another one you create)
Span Tag
There's a lot going on in the 2 CSS presentations. Using an external CSS, demonstrate as many of the items listed on the slides as you can.
This is a speed-review assignment, not a "make-look-nice" assignment. I'm not looking for headers and footers and a navigation, or centered boxes. I'm simply asking you to review as many of the topics as you can to be ready to hit the ground running with Javascript and App Design.
Some of you are coming into Web 2 straight out of Web 1, so you're ready to just push forward, but some of you haven't touched web development for 6 months... a year... a really long time.
This unit is meant to summarize the portions of Web1 that will be most important to Web 2. Design is far less important than it was before, but it's crucial to understand the basic HTML tags, CSS attributes, and simple layouts.
Games to refresh on CSS & Flexbox:
The following lessons/challenges are learning resources. We may or may not use these resources, but they're great for your reference.
Mozilla JS Fundamentals Curriculum - Official JS Curriculum by Mozilla
Mozilla JS Tutorials - Official JS Topics by Mozilla
W3Schools JavaScript - W3Schools JS References
JSChallenge - Beginner Friendly Javascript Exercises
The following idea was developed by a West Salem High School student and I thought the idea was ingenious and wanted to incorporate it into our class as a simple 1st project
Write a simple app that contains 4 (or more) buttons - each button should have text of something they might be affraid of (like spiders, or heights). Ask the user which they're most afraid of and when they click on the item it should display that thing.
Use the W3Schools ModalBox Example for this project. - Stop following the instructions when you reach the "Add Header and Footer" section.
This assignment will be walked through as a class with modifications made to follow how we'll divide code (HTML, CSS, JS), add event listeners, and process functions in the future.
Video - The DOM in 4 minutes
Concepts Learned (Summary)
Button Basics (Practice) Trigger a button
Text Input Basics (Practice) Pull a single text value from a textbox
Multiple Text Inputs (Practice) Pull values from multiple textboxes
MadLibs (Graded) Create a basic MadLibs app.
Concepts Learned (Summary)
Number Basics (Practice) Pull #'s from text boxes (and make sure they're not text)
Math Stuff (Graded) Pull 3 #'s from text boxes, convert to floats, do math stuff.
Temperature Converter (Graded) Convert from Celsius to Fahrenheit and Kelvin
Maybe add a cipher to the mix?
Concepts Learned (summary)
Random Basics Generate random #'s and do something with them on the page
Dice Roll 2 dice and display their results
Welcome Displays a different welcome message when loaded
Heads Or Tails Get a name & heads/tails option from the user. Generate a random #, convert it to heads or tails, and tell the user if they're right or wrong. If, however, their name is <pick name here>, tell them "I'm not playing this game with you!"Â
Magic 8-Ball (Graded) Generate random responses when a button is pressed
Rock Paper Scissors (Graded) Play Rock Paper Scissors against the computer
High/Low Game (Graded) Play a number guessing game with the computer
Other Math Write a Math Quizzing Application
Additional project ideas
Shakespearean Insult Generator
Hobbit Name Generator
Dad Jokes
Homework/Quiz generator
Reverse Guess the Number
Binary Magic
Learning Resources
W3Schools - Javascript Timing Events
When the program loads, the timer starts counting down.
Scare your friends with this website that pretends to be the download bar for a virus. No download actually occurs, but the progress bar increases over time and displays messages based on how much progress has passed.
(The project is embedded as a live demo (that's not a picture). See it work by clicking the "Start Download" button)
This project helps you figure out how to use timers and String functions.
The pure bliss of watching colors changing before your eyes.
The goal of this is to create a color-changing effect over time.
How does it work?
Create a timer that triggers a function repeatedly (every 50ms)
Create 3 variables to represent your RGB values
Set r to 255
Set g to 0
Set b to 0
When the function is triggered
if r is less than 255 and g is 0 and b is 255
increase r
otherwise if r is 255 and g is 0 and b is greater than 0
decrease b
otherwise if r is 255 and g is less than 255 and blue is 0
increase g
otherwise if r is greater than 0 and g is 255 and b is 0
decrease r
otherwise if r is 0 and g is 255 and b is less than 255
increase b
otherwise if r is 0 and g is greater than 0 and b is 255
decrease g
otherwise
increase r
decrease g
decrease b
Change the background color to the new RGB values.
document.body.style.backgroundColor = "rgb("+r+", "+g +", "+b+")";Â Â
EC: Display the numeric color values for your R, G, and B values. I'm showing mine through a modal box.
Implement some app that utilizes a timer in some way different from what we've done already.
Stopwatch
Start Button - Starts the timer (setInterval - suggestion: 50ms or less)
Stop Button - Stops the timer (clearsInterval)
Lap Button - Takes current time and adds it to the output times (+=)
Reset Button - Clears the timer, Clears the Output
Digital Clock / Time Adjustment for regions
Figure out how to get the current time and display it.
Update the time frequently (at least every 1/2 second)
Do something based on the time (maybe have something change colors every second)
Allow the user to change the timezone to + or - the clock by 1 hour.
Quiz
Have a set of questions, each with a set of 4 possible answers the user has to choose from.
Display the question at the top
Display the possible answers in a 2x2 grid
Have a countdown timer that stops the quiz if the user hasn't finished answering the questions by the end of the countdown.
Typing Speed Test
Have the user type for x seconds.
Display the countdown
When the countdown reaches 0, lock the textbox.
Calculate the # of words per second.
Display results for the user.
Explore HTML Canvas.
Build something with a canvas that utilizes a timer
A ball that moves every 1/x of a second, for example
Final projects vary from year to year. Some years it's a specific project. Sometimes I allow students to create their own projects (meeting some list of requirements).
The following Link is to the 2023 Quiz project I had students complete.
Whatever the project, you should be expected to:
Create a decent looking HTML/CSS app.
Reference elements in an HTML file (getElementById)
Add event listeners to text boxes and buttons (or other elements) - "click" & "keyup"
Pull content from elements (value, innerHTML, textContent, innerText)
Push content to elements (value, innerHTML, textContent, innerText)
Modify Strings (concatenation & String functions)
Turn text to numbers and perform mathematical operations to them
Generate random #'s
Generate lists and add items to, remove items from, and get items from that list
Use if statements to perform tasks
Use timers to make changes over time.
I might be missing something, but this should cover most of it.
The following prompt was from the Oregon Skills USA Programming Challenge for 2024. It's not necessarily the full challenge, so read this whole section to know the full scope of your expectations.
"Create an interactive menu for your foodtruck that users can place orders through. Must include a printed receipt at the end of purchase, sale total, and at least 10 food items on the menu with varying prices. Please include functionality for adding items to cart, removing items, and adding multiple of the same item. Bonus: Include functionality to customize menu items (no cheese, light ice, etc.)"
Your challenge is based off of this challenge (but a little simpler): Create an interactive menu similar to that found in McDonalds or Costco for 5 items.
Do this for a Food truck (could be a real foodtruck, could be a madeup one, but make it something fun or meaningful to you. Be creative!).
Content and ideas can be found online, but ALL HTML, CSS, and JS should be your own.
You can get inspiration for things like modal boxes from W3Schools.
You can make use of CONCEPTS we did in earlier projects, but you may not copy and paste code.
You may use past projects as reference material (ie. You may look at past code).
Have a section (or sections) for items to appear or update as the user selects options.
Have an area (or areas) that calculate item costs, sales tax, & total cost
Have buttons with images & text to make selecting items easier
Include functionality that allows the user to add and remove items or increase and decrease the number of items.
Include an alarm of some sort (display/update time, ask the user if they're still ordering, etc.)
Images can be from any sources you'd like to use, as we're doing this as an educational experiment. Feel free to have fun with the theme of the cart (food you're interested in, movie/anime theme - maybe you want an all Harry Potter or Star Wars menu).
You're welcome to use AI to help with images, text, and ideas, but not with code. All HTML, CSS, and JS code should be your own.
E.C.
Provide a way to add special instructions for individual items (No cheese, light ice, add bacon, etc.) beyond a simple textbox (use checkboxes or radio buttons to select or deselect items).
The following is an (unfinished) example for a food truck specializing in soda floats.
Hitting arrows increases or decreases item count and the total updates accordingly.
Hitting "View Order" shows the full breakdown of costs
Grading Criteria:
5 items the user can buy.
Foodtruck Theme
You wrote all the code
A section for the items being purchased to be displayed in some way
Costs displayed:
Subtotal (cost of all items)
Sales Tax (subtotal * ____ --> 7% would be 0.07)
Total (subtotal + tax)
Items can be added
Totals adjust accordingly
Items can be removed
Totals adjust accordingly
Alarm used in some way (Update time, display how long the user has been ordering, popup that asks the user if they need more time...)
E.C.
Allow for order modification (extra pickles, no onions) - can't be a simple textbox.
To Do List
Flash Cards
Youtube - Web Dev Tutorials - 25 Beginner JS Projects
These videos will potentially be divided into the resources listed above, but are listed here for now to help me prepare the content for being divvied up.
These tutorials are great because the developer uses resources to improve design such as Bootstrap and ResponsiveDesignTesting
#1 - Colors - A simple button that uses JavaScript to change the background-color (style manipulation ,lists).
#2 - HEX Colors - Generate a random background color (Math.random, style manipulation, Loops, Lists)
#3 - Random Quote Generator - Generates a random Quote (Array+Dictionary, Math.random,Â
... More to come
JQuery allows us to simplify certain Javascript commands
The following 4 are summaries of important Javascript topics.
W3Schools JQuery Selectors
W3Schools JQuery HTML
W3Schools JQuery CSS
W3Schools JQuery DOM
This final link is the beginning of a much more detailed JQuery tutorial set:
W3Schools JQuery Intro
W3Schools JS For Loops - Typical #'d loop
W3Schools JS For In - Loops through properties of an object
W3Schools JS For Of - Loops through Values of a list
W3Schools JS While Loops - Typical unknown # of loops
Each of the following is the beginning of a set of instructions related to Canvas.
W3Schools Canvas Intro
W3Schools Game Intro
W3Schools Clock Intro
W3 Schools JS Cookies - Stored by the server
W3 Schools JS Web Storage API - Stored by the client