I am writing a little webpage that collects collects/displays information when a user's mouse hovers over a div information is sent into an array (via javascript function) I only want the array to hold 5 items (have have been collected). For some reason this should be easy but I am unable to figure it out. Here is my code, what am I doing wrong?
Have a good one,
timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
-Need more cow bell!!!
Code:
<html>
<head>
<script type="text/javascript">
var countMe = 0;
var testArray = new Array();
function countOver()
{
if(testArray.length > 5){
testArray.shift();
}
testArray[countMe] = countMe + ' Hey man : ' + testArray.length + '<br/>';
document.getElementById('showMe').innerHTML = testArray.join('');
countMe++;
}
</script>
</head>
<body>
<br/>
<div id="hoverMe" onmouseover="countOver()">Hover Over Me</div>
<div id="showMe"></div>
</body>
</html>
Have a good one,
timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
-Need more cow bell!!!