I have a code that randomly shows a picture on the screen:
<html>
<head>
<title>Test</title>
<script type="text/javascript">
var imageURLs = [
"www._.com/test.jpg"
, "www._.com/test.jpg"
, "www._.com/test.jpg"
];
function getImageTag() {
var img = '<img src=\"';
var randomIndex = Math.floor(Math.random() * imageURLs.length);
img += imageURLs[randomIndex];
img += '\" alt=\"Some alt text\"/>';
return img;
}
</script>
</head>
<body>
<script type="text/javascript">
document.write(getImageTag());
</script>
</body>
</html>
Each picture is a math problem. How do I assign each picture a different solution and put an input box that checks weather the input matches it depending on the displayed picture?
Aucun commentaire:
Enregistrer un commentaire