Hi,
I am trying to work through javascript using a tutorial. I came upon a problem that I cannot figure out why it doesn’t work.
The idea is to create a random number using an external file; then to combine it with a string value which names an image file, then load the image file into the html page.
(note: the random.js works fine. I tested by just using the variable and 5 random numbers appeared)
<head>
<script>
function showimg() {
/* The showimg() function displays a random image from the 0.jpg
through 9.jpg files. The random image is designed to thwart
hackers attempting to enter the library records database by
requiring visual confirmation.
var imgNumber = randomInteger(9); */ return a random number from 0
to 9*/
document.write (“<img src=’imgNumber.jpg alt=” /’>”);
}
</script>
</head>
<body>
(showimg)
(showimg)
(showimg)
(showimg)
(showimg)
</body>
I am open to constructive criticism, so any and all information is appreciated.
Thanks in advance,
jake