Markup: HELP : Randomly Selected Image Reload - javascript

started by Prae on May 13, 2005 — RSS Feed

Prae Prae
Posts: 1

my regards to all here in these forums .


i found my way here via this post .;action=display;num=1098932854


it seemed to answer my question as to how i would create a page

with a single . dynamically reloading image . but i've created

another problem .

i had gone about trying to work this out in JAVASCRIPT .

i followed this tutorial =]

. . . . . . . .

i used the .ZIP folder at the bottom to reconstruct the sample . i've gotten it to work but once i tried to modify it

it all broke down .


is have a dynamically loading IMAGE . WHICH IS ITSELF A "LINK" for a pop up window . also done in java .

. . . . . .

would that doubling up of java somehow conflict or cancel out the affect ? ? ? ?

. . . . . .

this is a link to the test page for this PROBLEM =]

. . . . . . .

and the following is the fairly simple code . i centered the image using a WRAPPER div in the CSS .

. . . . . . . . . . . . . . . . . . . . . . . . . . .

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Reload to display randomly selected image</title>

<link href="layout.css" rel="stylesheet" type="text/css">

<script type="text/javascript" language="javascript">
function swapPic()
   var thePicture=document.getElementById("RandomImage";
   var picPath="001/photo"+rnd(3)+".png";"url("+picPath+"";
function rnd(n)
 return Math.floor(Math.random() * n) + 1;
<style type="text/css">
body {
     background-image: url(001/blackwhitelineseventeen.gif);

<body onload="swapPic()">

<div id="wrapper">

<div id="RandomImage"></div>



as you can see i am able to get the image to reload . but i can't seem

to use it as a LINK or BUTTON for a pop up window . ( which i need to

do in order to open up my .SWF file )

IF ANYONE COULD LEND SOME FURTHER advice . i'd greatly appreciate it . thanks . again .


Joe Gillespie Joe Gillespie
Posts: 528

The script you are using is only changing the image. You need to change the image and the attached link. If you use my script (that you alluded to), it will change the image and the link.

Superaverage Superaverage
Posts: 1

I'm looking for similar js code, that will swap a regular image (not background) randomly on browser refresh. I first tried to modify your code, but couldn't make it work. I've been at this for awhile, so many many thanks in advance if you can help...

Maskodok Eko Maskodok Eko
Posts: 171

TOP SEO | Jasa SEO Profesional

TOP SEO | Jasa SEO Profesional Agen Texas Poker Dan Domino Online Indonesia Terpercaya IDRPoker.COM Agen Texas Poker dan Domino Online Indonesia Terpercaya Agen Texas Poker Dan Domino Online Indonesia Terpercaya D

Kokokmas Kokokma Kokokmas Kokokma
Posts: 104

You know, Sim City Societies had a lot of potential, it was a great concept that was horribly developed and lacked any kind of depth. The idea of individualize buildings functioning independently playing its role in a largely diverse and thriving city.

The new Sim City appears to be the classic Sim City gameplay we saw with SC4, combined with a far better developed version of the Societies concepts. Looking great guys, don't let us down.

You must login to reply