www.webdeveloper.com
Results 1 to 2 of 2

Thread: javascript / <div> / text / slide show question...

  1. #1
    Join Date
    May 2012
    Posts
    9

    javascript / <div> / text / slide show question...

    is there a way i could link or use the verbiage " this is paragraph one " in a div tag ? because i need to attach css to it and im a big time newb when it comes to JavaScript and i don't want to have to escape js quotes every time i need to update the verbiage (which will be almost every other day...

    if someone could modify this code below so that i can insert code just like i would a div tag scenario & so that i'd have the option to attach css, i'd genuinely & severely appreciate it ! once again i am a newb be gentle

    <html>
    <head>
    </head>
    <style>
    .left{display:inline}
    </style>
    <body>
    <input type="button" value="<" onclick="move('down')" class="left"/>
    <div id="results" class="left">this is paragraph one</div>
    <input type="button" value=">" onclick="move('up')" class="left"/><br>
    <input type="button" value="stop" onclick="pause()" />
    <script type="text/javascript">
    var paras=["....paragraph 1", "...and paragraph two", "followed by paragraph three", "and paragraph four"];
    function move(dir){
    if(timer){clearTimeout(timer)}
    if(dir=="down"){
    paras.unshift(paras.pop())
    } if(dir=="up"){
    paras.push(paras.shift())

    }
    timer=setTimeout(function (){move(dir)}, 2000)
    document.getElementById("results").innerHTML=paras[0];
    }
    var timer=setTimeout(function (){move("up")}, 2000)

    function pause(){
    clearTimeout(timer);
    }
    </script>

    </body>
    </html>

  2. #2
    Join Date
    Nov 2010
    Posts
    1,100
    but wait... this:
    Code:
    <div id="results" class="left">this is paragraph one</div>
    is the div where your text appears, so can't your css just be:
    Code:
    #results{
    /* whatever */ 
    }
    ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles