Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Dan Grace
/
MPCS_52553_Winter_2020
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4564d4fe
authored
Feb 02, 2020
by
Jeff Cohen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assign hw3
parent
f8ce3d77
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
0 deletions
hw3/README.md
hw3/bikes.html
hw3/README.md
0 → 100644
View file @
4564d4fe
# Homework #3
15 points
**DUE: Thursday, February 13 by 5:30pm**
For easiest viewing of these instructions, view online on Github.com or use a Markdown previewer.
### Instructions
This assignment will help you get practice at manipulating the DOM
with JavaScript.
Watch the instructional video here: https://youtu.be/3-R_hM5eVO8
You will need to become familiar with:
*
[
HTML Entities
](
https://developer.mozilla.org/en-US/docs/Glossary/Entity
)
*
[
The `<select>` Element
](
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
)
*
[
Element methods and navigating the DOM tree
](
https://developer.mozilla.org/en-US/docs/Web/API/Element
)
*
Possibly more
### Part 1. Marking Favorite Stations
Start by opening the
[
bikes.html
](
bikes.html
)
page.
NOTE: You will earn 1 point if you solve this part without modifying any existing HTML code.
*
Allow the user to click the heart icon next to a station name to
add it to their list of favorites.
*
(2 points) The heart should become a filled-in heart (HTML entity
`♥`
)
*
(3 points) The station name should be added to the list of Favorites
*
Allow the user to click the filled-in heart of a station name
to remove it from their list of favorites.
*
(2 points) The heart should become an outlined heart (HTML entity
`♡`
)
*
(3 points) The station name should be removed from the list of Favorites
*
HINT: Test carefully. Make sure you can toggle the favorite status on and off many times, not just the first time!
### Part 2. Filtering The Station List by Area
You will need to add new HTML code in order to solve this exercise.
*
Allow the user to select a filter:
*
(1 point) "All" should show all of the stations
*
(1 point) "University of Chicago" should show only stations near campus
*
(1 point) "Loop" should show only stations near the Loop
*
(1 point) "North Side" should show only stations on the north side
*
HINT: Read the HTML source code to find the CSS classes that indicate
which stations belong to which area.
hw3/bikes.html
0 → 100644
View file @
4564d4fe
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity=
"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
crossorigin=
"anonymous"
>
<title>
Homework #3: Bike Stations
</title>
<style>
.fave
{
padding-right
:
1em
;
cursor
:
pointer
;
color
:
red
;
}
</style>
</head>
<body>
<div
class=
"container mt-5"
>
<div
class=
"row"
>
<div
class=
"col"
>
<h1>
Divvy Stations
</h1>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col mr-4"
>
<p>
Area:
<select>
</select>
</p>
<div
class=
"row"
>
<div
class=
"col"
>
<table
id=
"stations"
class=
"table table-striped border"
>
<thead>
<tr><th
colspan=
"2"
>
Station Name
</th></tr>
</thead>
<tbody>
<tr
class=
"loop"
><td><span
class=
"fave"
>
♡
</span></td><td>
Buckingham Fountain
</td></tr>
<tr
class=
"loop"
><td><span
class=
"fave"
>
♡
</span></td><td>
Shedd Aquarium
</td></tr>
<tr
class=
"loop"
><td><span
class=
"fave"
>
♡
</span></td><td>
Burnham Harbor
</td></tr>
<tr
class=
"loop"
><td><span
class=
"fave"
>
♡
</span></td><td>
Michigan Ave
&
Washington St
</td>
<tr
class=
"uchicago"
><td><span
class=
"fave"
>
♡
</span></td><td>
Harper Ave
&
59th St
</td></tr>
<tr
class=
"uchicago"
><td><span
class=
"fave"
>
♡
</span></td><td>
Museum of Science and Industry
</td></tr>
<tr
class=
"uchicago"
><td><span
class=
"fave"
>
♡
</span></td><td>
Ellis Ave
&
60th St
</td></tr>
<tr
class=
"north"
><td><span
class=
"fave"
>
♡
</span></td><td>
Clark St
&
Armitage Ave
</td></tr>
<tr
class=
"north"
><td><span
class=
"fave"
>
♡
</span></td><td>
Broadway and Argyle St
</td></tr>
<tr
class=
"north"
><td><span
class=
"fave"
>
♡
</span></td><td>
Sheffield Ave
&
Waveland Ave
</td></tr>
</tbody>
</table>
</div>
<div
class=
"col"
>
<table
id=
"favorites"
class=
"table table-bordered"
>
<thead>
<tr><th>
My Favorite Stations
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script
src=
"https://code.jquery.com/jquery-3.3.1.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
></script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment