Need help with randomInteger() script

Discussion in 'JavaScript' started by cvandijk, Sep 5, 2010.

  1. #1
    I've having trouble with a JavaScript. I need to write a script that randomly displays images everything the page is refreshed. I have 9 images that are numbers. I've uploaded the files. The problem I'm having is either I can only get 1 image to show up or none at all. I know I'm missing something. Can you help? Listed below is what I need to have in the file:
    1. randomInteger() function is stored in an external file (text file attached)
    2. created function named showImg(). The purpose of this function is to write an inline image into the currect document. The function has no parameters
    3. I need the showImg() function to display a random image. The images are numbers and they are labeled 0.jpg through 9.jpg.
    4. I need to declare a variable named imgNumber equal to the value returned by the randomInteger() function. I need to use 9 as the value of the size parameter in the randomInteger() function.

    Are you able to help with the code?
     

    Attached Files:

    cvandijk, Sep 5, 2010 IP