Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Rotating pictures

Reply
Thread Tools

Rotating pictures

 
 
Sehboo
Guest
Posts: n/a
 
      10-13-2005
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.

 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      10-13-2005
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)

 
Reply With Quote
 
 
 
 
Sehboo
Guest
Posts: n/a
 
      10-13-2005
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];
}

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      10-13-2005
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)

 
Reply With Quote
 
Sehboo
Guest
Posts: n/a
 
      10-13-2005
I have SQL Server.

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

 
Reply With Quote
 
Andrew
Guest
Posts: n/a
 
      10-13-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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];
> }
>



 
Reply With Quote
 
Sehboo
Guest
Posts: n/a
 
      10-13-2005
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.

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      10-13-2005
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)

 
Reply With Quote
 
Andrew
Guest
Posts: n/a
 
      10-14-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.
>



 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      10-14-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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)

 
Reply With Quote
 
 
 
Reply

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rotating my digital pictures ng_reader Computer Support 9 01-08-2007 02:27 AM
Rotating pictures on Adobe photo shop elements 4 Bowels Digital Photography 7 08-29-2006 12:53 AM
Rotating my shield harmonics MCSE 16 06-13-2005 03:23 PM
Rotating a Picturebox Charles A. Lackman ASP .Net 1 10-14-2004 09:39 AM
rotating pictures ... with XP...help! Wdflannery Digital Photography 13 08-19-2004 01:14 PM



Advertisments