/    Sign up×
Community /Pin to ProfileBookmark

random image problem

Hello,

I took over a project that some one else developed and Im having trouble with the random image banner..This script is in the head

[QUOTE]

<script language=”JavaScript”>
Image_1_Array=new Array(
“/photos/head_photos/1.jpg”,
“/photos/head_photos/2.jpg”,
“/photos/head_photos/3.jpg”,
“/photos/head_photos/4.jpg”,
“/photos/head_photos/5.jpg”,
“/photos/head_photos/6.jpg”);
random_image_1=Math.floor(Image_1_Array.length*Math.random());
random_image_1='<IMG SRC=”‘+ Image_1_Array[random_image_1]+ ‘” alt=”” height=”200″ width=”200″ border=”0″>’;

Image_2_Array=new Array(
“/photos/head_photos/7.jpg”,
“/photos/head_photos/8.jpg”,
“/photos/head_photos/9.jpg”,
“/photos/head_photos/10.jpg”,
“/photos/head_photos/11.jpg”,
“/photos/head_photos/12.jpg”);

random_image_2=Math.floor(Image_2_Array.length*Math.random());
random_image_2='<IMG SRC=”‘+ Image_2_Array[random_image_2]+ ‘” alt=”” height=”200″ width=”200″ border=”0″>’;
</script>

[/QUOTE]

and this is in the body where I want the images to appear

[QUOTE]

<script>
<!–
document.write(random_image_1);
// –>
</script>

[/QUOTE]

Ok, the problem is I want to add more images into the rotation but when I do the whole thing stops working ?

[QUOTE]

<script language=”JavaScript”>
Image_1_Array=new Array(
“/photos/head_photos/1.jpg”,
“/photos/head_photos/2.jpg”,
“/photos/head_photos/3.jpg”,
“/photos/head_photos/4.jpg”,
“/photos/head_photos/5.jpg”,
“/photos/head_photos/6.jpg”
“/photos/head_photos/7.jpg”,
“/photos/head_photos/8.jpg”,
“/photos/head_photos/9.jpg”);
random_image_1=Math.floor(Image_1_Array.length*Math.random());
random_image_1='<IMG SRC=”‘+ Image_1_Array[random_image_1]+ ‘” alt=”” height=”200″ width=”200″ border=”0″>’;

Image_2_Array=new Array(
“/photos/head_photos/7.jpg”,
“/photos/head_photos/8.jpg”,
“/photos/head_photos/9.jpg”,
“/photos/head_photos/10.jpg”,
“/photos/head_photos/11.jpg”,
“/photos/head_photos/12.jpg”
“/photos/head_photos/13.jpg”,
“/photos/head_photos/14.jpg”,
“/photos/head_photos/15.jpg”
“/photos/head_photos/16.jpg”,
“/photos/head_photos/17.jpg”,
“/photos/head_photos/18.jpg”);

random_image_2=Math.floor(Image_2_Array.length*Math.random());
random_image_2='<IMG SRC=”‘+ Image_2_Array[random_image_2]+ ‘” alt=”” height=”200″ width=”200″ border=”0″>’;
</script>

[/QUOTE]

what am I missing? I should be able to have as many images as I want.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Arty_EffemFeb 25.2008 — what am I missing?[/QUOTE]Commas after 6.jpg & 15.jpg
Copy linkTweet thisAlerts:
@MrMJSauthorFeb 25.2008 — Hello,, right in front of me.. :o

Thank you for your help!
×

Success!

Help @MrMJS spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...