help JS random image
help JS random image
- Started
- Last post
- 2 Responses
- nocomply
I'm trying to come up with a semantic and unobtrusive way to display a random image using HTML and javascript.
Basically, I'm using JS to generate a random number (1-19) which corresponds to the filename of a jpeg image (1.jpg - 19.jpg) I want to display.
I wrote a function using this tutorial to get my random number:
http://www.javascriptkit.com/jav…But how to I call that function in an img tag in a way that will validate and degrade gracefully? Is there a way to do it without an inline JS call? Has anyone done something similar before that they can link to? thanks!
- nocomply0
Thanks that ALA article at the top there looks pretty good. Didn't find it on my google searching.