NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page image rotate script

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 11-05-2007, 07:31 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
John84's Avatar
Join Date: Apr 2006
Posts: 267
John84 is an unknown quantity at this point
 



image rotate script


Hi All,

using the following javascript code to randomly rotate images...

Code:
<!-- Begin
var interval = 2.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;

var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("http://www.website.com/images/pic1.jpg");
image_list[image_index++] = new imageItem("http://www.website.com/images/pic2.jpg");
image_list[image_index++] = new imageItem("http://www.website.com/images/pic3.jpg");
var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}
//  End -->
...however, I no longer want it random and would like it to go in order. Can this be done with this peice of code?
John84 is offline  
Old 11-06-2007, 06:42 PM   #2 (permalink)
NamePros Member
Join Date: Jul 2006
Posts: 94
sote is a jewel in the roughsote is a jewel in the roughsote is a jewel in the rough
 



Simple, just change the value of random_display on line 3 from 1 to 0.
__________________
Don't let you stop you ;)
sote is offline  
Old 11-06-2007, 06:44 PM   #3 (permalink)
Senior Member
 
TheWatcher's Avatar
Join Date: May 2003
Location: KING.NET
Posts: 3,479
TheWatcher has much to be proud ofTheWatcher has much to be proud ofTheWatcher has much to be proud ofTheWatcher has much to be proud ofTheWatcher has much to be proud ofTheWatcher has much to be proud ofTheWatcher has much to be proud ofTheWatcher has much to be proud of
 



Originally Posted by sote
Simple, just change the value of random_display on line 3 from 1 to 0.
I'm about to say that.
__________________
Get your own .CO $28/yr http://NeedName.com
KING.NET Advertise your products and services. Got Facebook, connect with me. http://facebook.com/domainnetwork
WebeW.com - YA.NET Alternative Domain Name!. Use it for your site or blog.
TheWatcher is offline  
Old 11-07-2007, 12:04 AM THREAD STARTER               #4 (permalink)
NamePros Regular
 
John84's Avatar
Join Date: Apr 2006
Posts: 267
John84 is an unknown quantity at this point
 



that seems to stop the script all together
John84 is offline  
Old 11-07-2007, 04:31 AM   #5 (permalink)
New Member
Join Date: Nov 2005
Posts: 6
LovesYou is an unknown quantity at this point
 



Originally Posted by John84
that seems to stop the script all together
How does the code look now?
LovesYou is offline  
Old 11-07-2007, 08:30 PM THREAD STARTER               #6 (permalink)
NamePros Regular
 
John84's Avatar
Join Date: Apr 2006
Posts: 267
John84 is an unknown quantity at this point
 



I ended up just finding a different script altogether to accomplish what I needed. This thread can be closed. Thanks for those who offered help.
John84 is offline  
Old 11-10-2007, 01:04 PM   #7 (permalink)
Account Closed
Join Date: Aug 2007
Posts: 24
Mystery is an unknown quantity at this point
 



I have a very cool image script, probably the BEST! PM me for details.
Mystery is offline  
Old 11-11-2007, 07:43 AM   #8 (permalink)
NamePros Member
Join Date: Mar 2006
Posts: 139
leusmith is an unknown quantity at this point
 



My friend... if you dont want to mess with code then use a good site that provides image rotator services... There are many good ones(and many are free too).

I also know one of my friends who started a site called imagerotation.com.
There are many users on the site and its simple too... so try it...

But if you want to offer a service where your users choose the images, then his site wont work for you...

Also try the YUI... thats the Yahoo User Interface library... Its a free download from developer.yahoo.com
leusmith is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 07:01 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger