Array Example

Assignment 1

by Ryan Brown

HTML

<style>
body {background-color: powderblue; font-family: courier; font-size: 150% ;}

</style>


<body>

<input type="button" id="btnSearch" value="Pick One" onclick="GetValue();" />
<p id="message">Randomly Choose a student by clicking Above</p>
</body>

JavaScript

function GetValue() {
  var myarray = new Array("Che Zavala", "Chris West", "Jeff Vest", "Roger Thompson", "Lawrence Thomas", "Liam Sweeney", "Adam Stadther", "Morgan Southard", "Bradley Saylor", "Brandon Parker" );
  var random = myarray[Math.floor(Math.random() * myarray.length)];
  document.getElementById("message").innerHTML = random;

}