Random Array
by vzufelt
HTML
<!DOCTYPE html>
<html>
<body>
<input type="button" id="btnSearch" value="Search" onclick="myFunction();" />
<p id="message" >Victor</p>
</body>
</html>
JavaScript
//Creating a function
function myFunction()
{
//Creating Variable & Array for all the students
var Students= new Array("Victor","Alexander","Andrew","Aren","Arlene","Austin","Brian","Casandra","Chad","Christopher","Christopher","Clarence","Donahue","Ebony","Ember","Eugene","Henry","Jacob","Jason","Jeff","Jonathan","Jorge","Joseph","Maria","Mark","Melinda","Michael","Miguel","Mina","Patrick","Ret","Robert","Scot","Sean","Thomas","Yvonne");
//Variable to select randomly
var random = Students[Math.floor(Math.random() * Students.length)];
document.getElementById("message").innerHTML=random;
}