473,386 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Rotating pictures

Hi,
I am looking for code which can rotate pictures without refreshing the
page. I want to read randomly selected 5 images from
database and then keep on rotating them every 5 seconds.
Any help is appreciated.

Oct 13 '05 #1
10 6813
Sehboo wrote on 13 okt 2005 in microsoft.public.inetserver.asp.general:
I am looking for code which can rotate pictures without refreshing the
page. I want to read randomly selected 5 images from
database and then keep on rotating them every 5 seconds.

And you want to do this serverside?
Only the random selection can be done serverside.
For the "rotation" I would suggest you go to a clientside NG.

And then, did you have some code in mind,
or do you want someone to do all the work?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 13 '05 #2
Hi,

I have the javascript code which does the slideshow, but I want to read
the image URLs from database, and not hard code them here. Here is
what I have so far.

var timerID=0;

var imgArray = new Array("images\116.gif", "images\117.gif",
"images\118.gif", "images\119.gif");
// I want to read the above array from database.

function setupAdbanner() {
rotateBanner();
timerID = setInterval("rotateBanner()", 5000);
}

function cleanupPage() {
if (timerID)
clearInterval(timerID);
}

function rotateBanner() {
imgIndex = Math.ceil(Math.random() * imgArray.length) - 1;
document.images["HatContestPhotos"].src= imgArray[imgIndex];
}

Oct 13 '05 #3
Sehboo wrote on 13 okt 2005 in microsoft.public.inetserver.asp.general:
var imgArray = new Array("images\116.gif", "images\117.gif",
"images\118.gif", "images\119.gif");
// I want to read the above array from database.


Now we are getting somewhere.
[please always quote the text you are responding on,
this is usenet, not email]

Next question is, what database you have?
..mdb-file, .txt-file, etc.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 13 '05 #4
I have SQL Server.

(I don't know how to include the original text - It is not giving me
the option to include it)

Oct 13 '05 #5
you have to load all the images to the client's browser and minimize them
first, then your script can call them as you want.
If the client's browser doen't request anything when it is static, it can't
display the images from your server?

<img src="images/0.gif" width="1" height="1">
<img src="images/1.gif" width="1" height="1">
<img src="images/2.gif" width="1" height="1">
<img src="images/3.gif" width="1" height="1">
<img src="images/4.gif" width="1" height="1">
"Sehboo" <ma*********@hotmail.com> wrote in message
news:11********************@o13g2000cwo.googlegrou ps.com...
Hi,

I have the javascript code which does the slideshow, but I want to read
the image URLs from database, and not hard code them here. Here is
what I have so far.

var timerID=0;

var imgArray = new Array("images\116.gif", "images\117.gif",
"images\118.gif", "images\119.gif");
// I want to read the above array from database.

function setupAdbanner() {
rotateBanner();
timerID = setInterval("rotateBanner()", 5000);
}

function cleanupPage() {
if (timerID)
clearInterval(timerID);
}

function rotateBanner() {
imgIndex = Math.ceil(Math.random() * imgArray.length) - 1;
document.images["HatContestPhotos"].src= imgArray[imgIndex];
}

Oct 13 '05 #6
I don't know if this will work. How can I call asp function from
javascript? If that is possible then I can just call database from my
asp function.

Oct 13 '05 #7
Sehboo wrote on 13 okt 2005 in microsoft.public.inetserver.asp.general:
I don't know if this will work.
What will work? If you don't show us where you are answering on, how
should we know where you are talking about?
How can I call asp function from
javascript? If that is possible then I can just call database from my
asp function.


No that is impossible, as serverside asp executes first and sends the
result as a html-file tot he client.

=========

I am not versed in SQL server, but with the jet-engine [MS-access]
I would do something like this:
================================================== =====
<%
[open the database]

SQL = "select imgName from imgTable"
mD = CONNECT.Execute(SQL)

response.write "<script type= 'text/javascript'>"
response.write "var clientsideArray() = new Array()"
Do Until mD.Eof
response.write "clientsideArray(i++) = '" & mD("imgName") & "'"
mD.MoveNext
Loop
response.write "</script>"
[close the database]
%>
================================================== ====

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 13 '05 #8
Try this:

<script language="JavaScript">
<!--
var bannerNum = 1;
function rotateBanner() {
if (++bannerNum > 4)
bannerNum = 1;
document.images["pics"].src = "images/" + bannerNum + ".gif";
window.setTimeout('rotateBanner();', 5000);
}
//-->
</script>
<img name="pics" src="images/1.gif" >
"Sehboo" <ma*********@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I don't know if this will work. How can I call asp function from
javascript? If that is possible then I can just call database from my
asp function.

Oct 14 '05 #9
Andrew wrote on 14 okt 2005 in microsoft.public.inetserver.asp.general:
Try this:

<script language="JavaScript">
<!--
var bannerNum = 1;
function rotateBanner() {
if (++bannerNum > 4)
bannerNum = 1;
document.images["pics"].src = "images/" + bannerNum + ".gif";
window.setTimeout('rotateBanner();', 5000);
}
//-->
</script>
<img name="pics" src="images/1.gif" >
"Sehboo" <ma*********@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I don't know if this will work. How can I call asp function from
javascript? If that is possible then I can just call database from my
asp function.


[please do not toppost on usenet]

Andrew, where do you answer the ASP question?
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 14 '05 #10
something like www.aspbanner.com can rotate pictures, any code or text
actually according to the docs
"Sehboo" <ma*********@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi,
I am looking for code which can rotate pictures without refreshing the
page. I want to read randomly selected 5 images from
database and then keep on rotating them every 5 seconds.
Any help is appreciated.

Dec 5 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ian Hubling | last post by:
I'm trying to complete a rotating banner ad within a page I have. The rotating add has four images that rotate in three-second increments. I've got the images to rotate ok - but now I want to go...
1
by: Sandy Bremmer | last post by:
I have seen many Javascripts that rotate images with each load or refresh of the page but so far all I've found require hard coding the image filename into the script. Does anyone know of a script...
2
by: mikeoley | last post by:
Ok what I'm trying to do should be fairly simple. I have an image on a page that rotates with 4 other images. All I want to do is be able to link this images to different parts of the site...
14
by: mikeoley | last post by:
Why would this script below work on an html page: http://www.eg-designdev.com/aircylinders/test.htm But not a java page such as this: "http://www.eg-designdev.com/aircylinders/index3.jsp" Or...
2
by: Birch | last post by:
Hi, Is there a way to rotate a picture box? I haven't found any in MSDN library. I'm trying to make a simple game in which the user would be able to rotate a space ship. The only way I could...
3
by: avalence | last post by:
Hello, I am trying to create a nice rotating earth globe (on mouse) on my web site, in order to display my professional relationships all over the world. The best way seems to be a javascript. In...
11
by: bdbeames | last post by:
What I have is a is two sets of images,(Weather, optical) there is about 30 images of is each set. I have script that will rotate through the images on the main page. The user is able to view...
1
by: AR123 | last post by:
Hi I want to set up a rotating banner. Not sure how to incorporate my rotating banner code into the code below. I want the rotating banner to be the main feature image? This is set up in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.