03-70-Magic8Ball/magic8Ball-basic.html
<!doctype html>
<title>Magic 8 Ball - Version 1</title>
<link rel="icon" href="assets/eh-16.png">

<!-- = = = = = = = = =  C S S  = = = = = = = = = -->
<style>
</style>

<!-- = = = = = = = = =  H T M L  = = = = = = = = = -->

<div id="header">Magic 8 Ball</div>

<img src="assets/8ball1.png">

<div id="myResults">This is where our random message goes</div>

<button id="myButton" onclick="myButtonClick();">Click Me</button>

<!-- = = = = = = = = =  J A V A S C R I P T  = = = = = = = = = -->
<script>

/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
/* G L O B A L   V A R I A B L E S
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
var myResponses = ["Yes", "It is Certain", "No", "Ask Again Later"];

var myResults = document.getElementById("myResults");

/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
/* F U N C T I O N S
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */

function myButtonClick()
{
    /* pick a random index */
    var randomIndex = getRndInteger(0, myResponses.length-1);
    /* get the random message from the array */
    var randomMessage = myResponses[randomIndex];
    /* show the message in the myResults div */
    myResults.innerHTML = randomMessage;
}

function getRndInteger(min, max) {
    return Math.floor(Math.random() * (max - min + 1) ) + min;
}

</script>