-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the scoping problem of the buttonable function.
- Loading branch information
Showing
6 changed files
with
67 additions
and
12 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
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,16 @@ | ||
window.addEventListener('DOMContentLoaded', (event) => { | ||
// const btn = document.getElementById('maxEnd3Button'); | ||
// btn.addEventListener('click', alert('whipping')); | ||
let dice = {}; | ||
|
||
dice.roll5 = function() { | ||
return Math.ceil(5 * Math.random()); | ||
} | ||
|
||
dice.show5 = function() { | ||
// dice.el = document.getElementById('diceout'); | ||
dice.el.innerHTML = dice.roll5(); | ||
dice.el.style = `color: blue;` | ||
} | ||
|
||
}); |
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,14 @@ | ||
document.addEventListener('DOMContentLoaded', (event) => { | ||
|
||
let anchor = document.getElementById('maxEnd3'); | ||
let webform = ` | ||
<h3>Notice the distribution of results as you repeatedly roll a dice with sides of</h3> | ||
<div class="btn-group"> | ||
<button type="button" class="btn btn-primary btn-sm" onclick="dice.show5()" > five</button> | ||
<button type="button" class="btn btn-danger btn-sm" onclick="dice.show7()" > seven</button> | ||
</div> | ||
<h3 id="diceout" style="color:transparent">null 99</h3> | ||
`; | ||
anchor.innerHTML = webform; | ||
}); |
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 @@ | ||
return("we hit a succesful test"); |
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
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