Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: SV: Random Image


Message #1 by "Robert Nyman" <robert.nyman@c...> on Tue, 22 Oct 2002 10:23:35 +0200
Tnx for reply.
Hovik.
----- Original Message -----
From: "Robert Nyman" <robert.nyman@c...>
To: "javascript" <javascript@p...>
Sent: Tuesday, October 22, 2002 11:53 AM
Subject: [javascript] SV: Random Image


Well, maybe something like this will work for you:

For example, you have three images named:
image0, image1 and image2

var intImage = parseInt((Math.random() * 2), 10);
document.getElementById("theImage").src = ("image" + intImage);

HTML:

<image id="theImage" name="theImage">


/Robert


-----Ursprungligt meddelande-----
Från: Hovik Melkomian [mailto:melvik@b...]
Skickat: den 21 oktober 2002 10:46
Till: javascript
Ämne: [javascript] Random Image


Hi list:
I wanna put a image randomly from 3 pic.
Could any 1 help me in this issue.

Thnaks in advance,
Hovik.




---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20



  Return to Index