1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Text slideshow in javascript - need help

Discussion in 'JavaScript' started by MrMalik, May 15, 2009.

  1. #1
    Hi all ! I want to develop a text slideshow for welcome page of my website. i want to set interval of 10 secs between each slide, also i want to use dynamic text that must come from database in this text slideshow rather than just relying on static text. Please please help. It's urgent.
     
    MrMalik, May 15, 2009 IP
  2. mrmaf

    mrmaf Peon

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi Malik! I found this text slideshow very informative. In this text slideshow you can arrange slides by yourself, slides can come random and also it teachs how to get text from database and then show that text in the slides for this text slideshow. have a look over this Text slideshow in javascript
     
    mrmaf, May 15, 2009 IP
    MrMalik likes this.
  3. JavaScriptBank.com

    JavaScriptBank.com Peon

    Messages:
    141
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    JavaScriptBank.com, May 17, 2009 IP
  4. seokingdom07

    seokingdom07 Banned

    Messages:
    132
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    as you want to fetch your texts from database.
    First you store all your text separated with some delimiter in one variable (the server side variable ASP,PHP,.NET)
    then you can have tht variable in your javascript, you can use the reference given by mrmaf.
    then you can split the value of that variable delimited by some character & have it in JS array & rest of the code you can use same as follows:

    <html>
    <head>
    <title>Text Slideshow in javascript</title>
    <script type="text/javascript" language="javascript">
    var texts = "<%=variablename%>" ----- for ASP
    var texts = "<?=variablename?>" ----- for PHP
    var slideArray = split(texts, "yourdelimiter")
    function Slide()

    {

    for(i=0;i<slideArray.length;i++)
    document.getElementById('div_display').innerHTML=slideArray;
    setTimeout("secondSlide()",10000);
    }
    Slide()
    </script>
    </head>
    <body>
    <table width="100%" cellpadding="2" cellspacing="2">
    <tr>
    <td>
    <div id="div_display"><script type="text/javascript" language="javascript">Slide();</script></div>
    </td>
    </tr>
    </table>
    </body>
    </html>

    I have modified the code. Please check for syntax. You can use the logic
     
    seokingdom07, May 17, 2009 IP