-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added the JS workshop * Added in some more context around opening HTML files, updated header * Added image for IDE link to browser Co-authored-by: Rodger Gu <[email protected]>
- Loading branch information
Showing
5 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# MSA 2022 JS Workshop | ||
|
||
Welcome to the MSA JS workshop! This workshop will help you implement some basic JS scripting for a webpage. | ||
|
||
JS is a programming language that is used to create dynamic content on a webpage. It can be used to alter page elements, send alerts, call other code, etc. | ||
|
||
* Lets start by opening `js-workshop.html` in your browser (double-click the file and select the browser of your choice when prompted) | ||
|
||
![](images/2022-04-14-11-10-49.png) | ||
|
||
* Click the button labelled `Click Me!` - you should get an alert message! | ||
* This is because in `alerter.js`, there is a function called `sendAlert()` that is being called when the button is clicked! | ||
* The function sends an alert, which shows up as a popup on your browser when it is triggered | ||
* The function is referenced in `js-workshop.html` because within the html head, there is a `<script></script>` tag containing a reference to the `alerter.js` file. | ||
* Now let's make this page a little bit more interesting: | ||
- [ ] Let's make the `sendAlert` function also show the General Kenobi GIF that is on the page. | ||
- [ ] Start by referencing the id element within the html by using `document.getElementById()` so that you have access to the HTML element in JS | ||
- [ ] Set the hidden attribute on the document to false so that the image becomes visible when the function is called | ||
- [ ] Edit the HTML so that hidden is true by default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const sendAlert = () => { | ||
alert('Why Hello There'); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<title>MSA JS Workshop</title> | ||
<script src="alerter.js"></script> | ||
</head> | ||
<body> | ||
<div> | ||
<h1>MSA JS Workshop</h1> | ||
<button style="margin-bottom: 10px;" onclick="sendAlert()">Click Me!</button> | ||
<img id="general_kenobi" src="https://media0.giphy.com/media/7JC7bCJJGj44aBwB8p/giphy.gif?cid=ecf05e47sdjjm4r5yahgxqup8hbndi6j4n3b7x0i1tfs7fo1&rid=giphy.gif&ct=g" alt="General_Kenobi"/> | ||
</div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters