...

View Full Version : A different random image link script question



los5o7
03-26-2005, 11:04 AM
I recently had a problem with a random image link script that I got taken care of, and am now experiencing something of a similar issue with the same script when I try to get it to link to images instead of webpages.. here is the script:


<script language="JavaScript">
var rand1=Math.floor(Math.random()*5)+1
images = new Array(5)
images[1] = "art/thumbs/s7thumb.gif"
images[2] = "art/thumbs/s8thumb.gif"
images[3] = "art/thumbs/aathumb.jpg"
images[4] = "art/barbariansketchthumb.gif"
images[5] = "art/thumbs/s1thumb.gif"

var image = images[rand1]

links = new Array(5)
links[1] = "http://www.cr6productions.com/art/sketch7.jpg"
links[2] = "http://www.cr6productions.com/art/sketch8.jpg"
links[3] = "http://www.cr6productions.com/art/archangel.jpg"
links[4] = "http://www.cr6productions.com/art/barbariansketch.jpg"
links[5] = "http://www.cr6productions.com/art/sketch1.jpg"

var link = links[rand1]
</script> <script>
function hitmeup() {
newWindow = window.open('http://'+link+'', 'newWin', 'toolbar=no, location=no, directories=no, scrollbars=yes, resizable=yes, status=yes, width=700, height=525')
}
</script> <script language="JavaScript">
document.write('<a href="javascript:hitmeup()"><IMG SRC="' + image + '" border="2"></a>')
</script>

It displays the thumb nails fine, but when the thumb is clicked it brings up a page cannot be displayed window, instead of the image i'm trying to link it to, can anyone advise how to correct this issue?

Any and all assistance is greatly appreciated,
thanks in advance

vwphillips
03-26-2005, 11:45 AM
rand1 is set to a random number as the page is loaded but is not updated after that



<script>
function hitmeup() {
link = links[Math.floor(Math.random()*5)+1];
newWindow = window.open('http://'+link+'', 'newWin', 'toolbar=no, location=no, directories=no, scrollbars=yes, resizable=yes, status=yes, width=700, height=525')
}
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum