Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image swapping

Status
Not open for further replies.

artdirectoreric

Instructor
Jun 26, 2001
120
0
0
US
I am redesigning a golf site and the owner wants to swap out a photo in the upper-left corner every time the page is visited. The problem is this photo is screened back and behind the navigation bars. In other words, it's broken up into about 7 different pieces. I can easily name all of the photos so they form a set, like photo1_1, photo2_1, photo3_1, photo4_1, etc., etc. What I would then need is a way to randomly generate a number and use that variable to tell the code which set of pictures to display. I realize this is probably for the javascript forum, but I wanted to start here.
 
I found some cool things that I'll use for other projects, but something to do like what I described eluded me. If you think something there will fill the bill, would you make a direct link to it? Thanks.
 
Do you have .asp e.g. an IIS server? If so try in asp coding..

<%
Randomize
dim choice
choice=(7.49)*Rnd
choice=Round(choice)
%>
<%IF choice=0 then%>
<img src=&quot;picture1.gif&quot;>
<%ELSEIF choice=1 then%>
<img src=&quot;picture1.gif&quot;>
<%ELSEIF choice=2 then%>
<img src=&quot;picture2.gif&quot;>
<%ELSEIF choice=3 then%>
<img src=&quot;picture3.gif&quot;>
<%ELSEIF choice=4 then%>
<img src=&quot;picture4.gif&quot;>
<%ELSEIF choice=5 then%>
<img src=&quot;picture5.gif&quot;>
<%ELSEIF choice=6 then%>
<img src=&quot;picture6.gif&quot;>
<%ELSEIF choice=7 then%>
<img src=&quot;picture7.gif&quot;>
<%END IF%>

Just save the file as .asp in Frontpage and your IIS server should work with it fine.

Mazza.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top