Page is a not externally linkable
- WebmasterWorld
-- New To Web Development
---- How to have images on javascript that's not random


rocknbil - 8:46 pm on Jan 24, 2010 (gmt 0)


In reality comment is the same thing as deleting the line. That is, in Javascript, any line that begins with this

// this is a comment

will be ignored. It's a great way to experiment with other options and if it doesn't work, you can remove the comment lines and you're back where you were.

So the entire chunk of code I pasted can REPLACE the corresponding existing lines in the code. It all goes in the bottom of the code chunk, before your "// --> End" comment.

The logic is, instead of using random to set the image and link, it iterates through the list of images, hence the "i" variable.

Put it in a test page, try it out. :-)


Thread source:: http://www.webmasterworld.com/new_web_development/4066561.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com