New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Web Design and Hosting Creating sites, scripting, and hosting discussions.

Dual JS image randomizer?


Post Reply New Thread Subscribe

 
Thread Tools
Morgan19

 
Member Since: Apr 08, 2004
Posts: 129
Morgan19 is on a distinguished road

Morgan19 is offline
I use the following JS for a simple but effective image randomizer:

Code:
<SCRIPT LANGUAGE="JavaScript">
	  <!-- Hide from old browsers
	
	  iArray=new Array(
		"images/index_image1.jpg",
		"images/index_image2.jpg",
		"images/index_image3");
	  ri=Math.floor(iArray.length*Math.random());
	  ri='<IMG SRC="'+ iArray[ri]+ '" BORDER=0>';
	// end hiding --></SCRIPT>
Code:
<SCRIPT language="JavaScript">
	<!--
	document.write(ri);
	// -->
	</SCRIPT>
That works great to randomly pull one of the images listed. I'm curious, though... Would anyone like to take a crack at expanding that code so that a matching background image is pulled into that image's cell?

Basically what I'm getting at is that I have a cell with the random image code applied to it, but the cell expands horizontally the fill the browser window. Because each of the main images is a finite width, I'm left with a rather large and ugly gaping hole to the right of the image when a user expands their browser. To work around that, I'd like to create a repeating background image for that cell that would give the appearance of the image continuing to the right. Problem is, I have no idea what the code would be to match up each random "main" image with its background image, so that when the main one is randomly displayed the background image would match.

I'd be ridiculously grateful if anyone could help me out here.

Thanks,
m19
QUOTE Thanks
Morgan19

 
Member Since: Apr 08, 2004
Posts: 129
Morgan19 is on a distinguished road

Morgan19 is offline
Anyone?

m19
QUOTE Thanks

Post Reply New Thread Subscribe


« Are there any developer plugins for Safari? | iweb and video »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
OSX SERVER 10.0.3 AND G4 Dual Processor incompatible? Bailyflah OS X - Operating System 4 01-27-2007 05:07 PM
cd image komo Switcher Hangout 0 06-02-2006 03:30 AM
Image rotation destroys EXIF info -- help! djmitch Images, Graphic Design, and Digital Photography 5 09-10-2005 06:52 PM
dual 1.8G or 2G? digisam Apple Desktops 4 02-19-2005 09:46 AM
dual 1.25 powermac g4....worth it? jonmichael23 Apple Desktops 1 01-26-2004 01:42 AM

All times are GMT -4. The time now is 10:15 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?