Rotating pictures

Discussion in 'ASP General' started by Sehboo, Oct 13, 2005.

  1. Sehboo

    Sehboo Guest

    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.
     
    Sehboo, Oct 13, 2005
    #1
    1. Advertising

  2. Sehboo

    Evertjan. Guest

    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)
     
    Evertjan., Oct 13, 2005
    #2
    1. Advertising

  3. Sehboo

    Sehboo Guest

    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];
    }
     
    Sehboo, Oct 13, 2005
    #3
  4. Sehboo

    Evertjan. Guest

    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)
     
    Evertjan., Oct 13, 2005
    #4
  5. Sehboo

    Sehboo Guest

    I have SQL Server.

    (I don't know how to include the original text - It is not giving me
    the option to include it)
     
    Sehboo, Oct 13, 2005
    #5
  6. Sehboo

    Andrew Guest

    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" <> wrote in message
    news:...
    > 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];
    > }
    >
     
    Andrew, Oct 13, 2005
    #6
  7. Sehboo

    Sehboo Guest

    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.
     
    Sehboo, Oct 13, 2005
    #7
  8. Sehboo

    Evertjan. Guest

    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)
     
    Evertjan., Oct 13, 2005
    #8
  9. Sehboo

    Andrew Guest

    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" <> wrote in message
    news:...
    > 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.
    >
     
    Andrew, Oct 14, 2005
    #9
  10. Sehboo

    Evertjan. Guest

    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" <> wrote in message
    > news:...
    >> 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)
     
    Evertjan., Oct 14, 2005
    #10
  11. something like www.aspbanner.com can rotate pictures, any code or text
    actually according to the docs


    "Sehboo" <> wrote in message
    news:...
    > 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.
    >
     
    Kyle Peterson, Dec 5, 2005
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman

    Rotating a Picturebox

    Charles A. Lackman, Oct 13, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    951
    Supra
    Oct 14, 2004
  2. e4_java

    rotating a bufferedimage

    e4_java, Nov 29, 2004, in forum: Java
    Replies:
    7
    Views:
    1,096
    Babu Kalakrishnan
    Dec 1, 2004
  3. Ray

    Rotating text in chat?

    Ray, May 16, 2005, in forum: Java
    Replies:
    2
    Views:
    492
    Brooks Hagenow
    May 16, 2005
  4. mark | r

    rotating an image

    mark | r, Jul 2, 2003, in forum: HTML
    Replies:
    4
    Views:
    4,743
    Mark Parnell
    Jul 2, 2003
  5. Martin Raychev
    Replies:
    1
    Views:
    294
    Alvin Bruney [MVP]
    Mar 2, 2004
Loading...

Share This Page