I can't get figure out how to get this text input to properly activate the random shuffle image array. It will activate it, but on initial click. I would like it to require validation from the user inputting and then submitting text.
I apologize for uploading the script/html this way, but the forum won't let me make any posts with any HTML/script BB tags. please note that for 'img src="http://i.imgur.com/8bp6n2l.jpg" name="canvas",' the <'s have been replaced with ['s.
[HR][/HR]
var imagesArray = [
'https://assets.entrepreneur.com/content/3x2/1300/20150827173347-test-google-adwords-campaign-search-engine-internet.jpeg',
'https://yt3.ggpht.com/-DvvzUuiYGos/AAAAAAAAAAI/AAAAAAAAAAA/YoUb-VzIovA/s900-c-k-no-mo-rj-c0xffffff/photo.jpg',
'https://www.google.com/logos/doodles/2015/tu-bav-2015-5651988540817408-hp2x.jpg',
'https://www.google.com/doodle4google/images/splashes/featured.png',
'http://www.onetechstop.net/wp-content/uploads/2016/01/google-logo.jpg',
];
var usedImages = {};
var usedImagesCount = 0;
function displayImage(){
var num = Math.floor(Math.random() * (imagesArray.length));
if (!usedImages[num]){
document.canvas.src = imagesArray[num];
usedImages[num] = true;
usedImagesCount++;
if (usedImagesCount === imagesArray.length){
usedImagesCount = 0;
usedImages = {};
}
} else {
displayImage();
}
}
</script>
<html>
<head>
<body>
<center>
<form name="imageForm">
<tr align="center">
<td><br><br><br><br><br><br><br><br><br><br>
<br><br>
</td>
</tr>
<tr>
<td>
<center>
<input onclick="displayImage();" type="text" class="btn1" id = "textbox" size="60" ><br><br>
<br/>
</td>
</tr>
</table>
</form>
</head>
</body>
</html>
[HR][/HR]