33 users online (0 members and 33 guests)  


Page 2 of 7 First 1 2 3 4 5 6 ... Last
  Results 16 to 30 of 97

Related

  1. How to turn off magic quotes in PHP ?    Forum: PHP Forum
    Replies: 0
  2. Need html text script help    Forum: HTML Forum
    Replies: 2
  3. Rotating text load immediately?    Forum: Javascript Forum
    Replies: 4
  4. Rotating quotes script - help please    Forum: Website Scripts Forum
    Replies: 0
  1. #16
    htmlamateur's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    9

    Exclamation Re: Rotating Text/Quotes Script?

    Hi everyone, I need the code for it to show a new quote when you refresh the page.

  2. #17
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Rotating Text/Quotes Script?

    Hi there htmlamateur,

    and a warm welcome to these forums.

    Does this help...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>Rotating Quotes</title>
    
    <style type="text/css">
    body {
         color:#000;
         background-color:#aaa;
       }
    #quotes {
         margin:50px auto;
         font-family:verdana,arial,helvetica,sans-serif;
         font-size:16px;
         color:#000;
         width:324px;
         line-height:40px;
         border:1px solid  #000;
         background-color:#fff;
         text-align:center;
       }
     </style>
        
    <script type="text/javascript">
    
      var quote=[
                'This is quote number one',    /* add as many quotes as you like!*/
                'This is quote number two',
                'This is quote number three',
                'This is quote number four',
                'This is quote number five',
                'This is quote number six',
                'This is quote number seven',
                'This is quote number eight',
                'This is quote number nine',
                'This is quote number ten'
                ];
    
      var speed=2000;    /*this is the time in milliseconds adjust to suit*/
      var q;
      var obj;
    
    function init() {
       obj=document.getElementById("quotes").firstChild;
       rnd=Math.floor(Math.random()*quote.length)
       obj.nodeValue=quote[rnd];
       q=rnd+1;
       setTimeout('showQuote()',speed);
     }
    
    function showQuote() {
    if(q==quote.length) {
       q=0;
     }
       obj.nodeValue=quote[q];
       q++;
       setTimeout('showQuote()',speed);
     }
    
    if(window.addEventListener){
       window.addEventListener('load',init,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',init);
      }
     }
    </script>
    
    </head>
    <body>
    
    <div id="quotes">&nbsp;</div>
    
    </body>
    </html>
    

  3. #18
    htmlamateur's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    9

    Exclamation Re: Rotating Text/Quotes Script?

    Thanks coothead, that's great except, they still rotate without refreshing, i need the quote to change just on refreshing

    thanks
    Last edited by htmlamateur; 04-27-2009 at 11:02 AM.

  4. #19
    htmlamateur's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    9

    Re: Rotating Text/Quotes Script?

    Quote Originally Posted by coothead View Post
    Hi there htmlamateur,

    and a warm welcome to these forums.

    Does this help...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>Rotating Quotes</title>
    
    <style type="text/css">
    body {
         color:#000;
         background-color:#aaa;
       }
    #quotes {
         margin:50px auto;
         font-family:verdana,arial,helvetica,sans-serif;
         font-size:16px;
         color:#000;
         width:324px;
         line-height:40px;
         border:1px solid  #000;
         background-color:#fff;
         text-align:center;
       }
     </style>
        
    <script type="text/javascript">
    
      var quote=[
                'This is quote number one',    /* add as many quotes as you like!*/
                'This is quote number two',
                'This is quote number three',
                'This is quote number four',
                'This is quote number five',
                'This is quote number six',
                'This is quote number seven',
                'This is quote number eight',
                'This is quote number nine',
                'This is quote number ten'
                ];
    
      var speed=2000;    /*this is the time in milliseconds adjust to suit*/
      var q;
      var obj;
    
    function init() {
       obj=document.getElementById("quotes").firstChild;
       rnd=Math.floor(Math.random()*quote.length)
       obj.nodeValue=quote[rnd];
       q=rnd+1;
       setTimeout('showQuote()',speed);
     }
    
    function showQuote() {
    if(q==quote.length) {
       q=0;
     }
       obj.nodeValue=quote[q];
       q++;
       setTimeout('showQuote()',speed);
     }
    
    if(window.addEventListener){
       window.addEventListener('load',init,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',init);
      }
     }
    </script>
    
    </head>
    <body>
    
    <div id="quotes">&nbsp;</div>
    
    </body>
    </html>
    


    Thanks coothead, that's great except, they still rotate without refreshing, i need the quote to change just on refreshing

    thanks

  5. #20
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Rotating Text/Quotes Script?

    Hi there htmlamateur,

    sorry I misunderstood your requirements.

    Here is the revised code...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>Rotating Quotes</title>
    
    <style type="text/css">
    body {
         color:#000;
         background-color:#aaa;
       }
    #quote {
         margin:50px auto;
         font-family:verdana,arial,helvetica,sans-serif;
         font-size:16px;
         color:#000;
         width:324px;
         line-height:40px;
         border:1px solid  #000;
         background-color:#fff;
         text-align:center;
       }
     </style>
        
    <script type="text/javascript">
    
      var quotes=[
                'This is quote number one',    /* add as many quotes as you like!*/
                'This is quote number two',
                'This is quote number three',
                'This is quote number four',
                'This is quote number five',
                'This is quote number six',
                'This is quote number seven',
                'This is quote number eight',
                'This is quote number nine',
                'This is quote number ten'
                ];
    
    function showQuote() {
       document.getElementById("quote").firstChild.nodeValue=
       quotes[Math.floor(Math.random()*quotes.length)];
     }
    
    if(window.addEventListener){
       window.addEventListener('load',showQuote,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',showQuote);
      }
     }
    </script>
    
    </head>
    <body>
    
    <div id="quote">&nbsp;</div>
    
    </body>
    </html>
    

  6. #21
    htmlamateur's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    9

    Exclamation Re: Rotating Text/Quotes Script?

    Quote Originally Posted by coothead View Post
    Hi there htmlamateur,

    sorry I misunderstood your requirements.

    Here is the revised code...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>Rotating Quotes</title>
    
    <style type="text/css">
    body {
         color:#000;
         background-color:#aaa;
       }
    #quote {
         margin:50px auto;
         font-family:verdana,arial,helvetica,sans-serif;
         font-size:16px;
         color:#000;
         width:324px;
         line-height:40px;
         border:1px solid  #000;
         background-color:#fff;
         text-align:center;
       }
     </style>
        
    <script type="text/javascript">
    
      var quotes=[
                'This is quote number one',    /* add as many quotes as you like!*/
                'This is quote number two',
                'This is quote number three',
                'This is quote number four',
                'This is quote number five',
                'This is quote number six',
                'This is quote number seven',
                'This is quote number eight',
                'This is quote number nine',
                'This is quote number ten'
                ];
    
    function showQuote() {
       document.getElementById("quote").firstChild.nodeValue=
       quotes[Math.floor(Math.random()*quotes.length)];
     }
    
    if(window.addEventListener){
       window.addEventListener('load',showQuote,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',showQuote);
      }
     }
    </script>
    
    </head>
    <body>
    
    <div id="quote">&nbsp;</div>
    
    </body>
    </html>
    
    is there anyway, isnide the box, that html i want to use will work? here it is... http://www.10padvertising.com/rotatingtext
    Last edited by htmlamateur; 04-28-2009 at 05:41 PM.

  7. #22
    MJ080's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2009
    Posts
    1

    Exclamation Re: Rotating Text/Quotes Script?

    Hi, great post and exactly what i'm looking for, but unfortuantly something is not working properly for me. in IE, FF, Chrome and Opera, i get a white block with black border, (quite big) in the space that my text should be.

    i'm not sure if it is because i placed the javascript in a seperate folder and included it? or am i just an idiot...?

    any ideas?

    -----------------------------------------------

    okay well...i copied the code into my page, and all seems fine now!!! i am indeed an idiot! my bad!!!!!
    Last edited by MJ080; 06-19-2009 at 06:40 AM.

  8. #23
    caustic13's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2009
    Posts
    2

    Re: Rotating Text/Quotes Script?

    So how would you go about getting hyperlinks on each quote? I am trying to use this as a news ticker on a site I am creating. It works well so far but I can't seem to add links. Thanks!

  9. #24
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Rotating Text/Quotes Script?

    Hi there caustic13,

    and a warm welcome to these forums.

    Does this help...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>Rotating links</title>
    
    <style type="text/css">
    #link {
         font-family:verdana,arial,helvetica,sans-serif;
         font-size:16px;
         color:#000;
     }
    </style>
        
    <script type="text/javascript">
    
      var links=[
                'http://www.ahfb2000.com/',    /* add as many links as you like!*/
                'http://www.google.com/',
                'http://www.bbc.co.uk/',
                'http://www.alistapart.com/',
                'http://en-gb.www.mozilla.com/en-GB/firefox/central/',
                'http://validator.w3.org/',
                'http://www.hoogerbrugge.com/'
                ];
    
    function showlink() {
    
       obj=document.getElementById('link')
       temp=links[Math.floor(Math.random()*links.length)];
    
       obj.href=temp;
       obj.firstChild.nodeValue=temp.split('//')[1].split('/')[0];
     }
    
    if(window.addEventListener){
       window.addEventListener('load',showlink,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',showlink);
      }
     }
    </script>
    
    </head>
    <body>
    
    <div><a id="link" href="http://www.ahfb2000.com/">www.ahfb2000.com</a></div>
    
    </body>
    </html>
    
    

  10. #25
    caustic13's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2009
    Posts
    2

    Re: Rotating Text/Quotes Script?

    Quote Originally Posted by coothead View Post
    Hi there caustic13,

    and a warm welcome to these forums.
    Thanks a bunch. I will try it out and report back!

    E: is there a way I can edit the hyperlink text, you know so that the links aren't just []http://aaa.aaa.aaa/aaa/aa/a/aaa/aa.aaa[] you know

    Ok. Tried it out. Seems like the item will only change after a page refresh. Is there a way to get it to act more like the other scroller in this thread, changing after a couple seconds automatically? Thanks.
    Last edited by caustic13; 07-13-2009 at 11:53 AM.

  11. #26
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Rotating Text/Quotes Script?

    Hi there caustic13,

    does this help...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>Rotating links</title>
    
    <style type="text/css">
    #link {
        font-family:verdana,arial,helvetica,sans-serif;
        font-size:16px;
        color:#000;
     }
    </style>
        
    <script type="text/javascript">
    
      var links=[
                'http://www.ahfb2000.com/',    /* add as many links as you like! */
                'http://www.google.com/',
                'http://www.bbc.co.uk/',
                'http://www.alistapart.com/',
                'http://en-gb.www.mozilla.com/en-GB/firefox/central/',
                'http://validator.w3.org/',
                'http://www.hoogerbrugge.com/'
                ];
    
       var txt= [
                'this is the ahb forum',     /* txt length must equal the link length */
                'go to google',
                'the bbc tv site',
                'coding articles',
                'Firefox Central Page',
                'check your coding here',
                'the weird \'hoogerbrugge\' site'
                ];
    
      var speed=3000;    /*this is the time in milliseconds adjust to suit*/
      var c=0;
    
    function showlink() {
    
       obj=document.getElementById('link');
    
       obj.href=links[c];
       obj.firstChild.nodeValue=txt[c];
    
       c++;
    if(c==links.length) {
       c=0;
     }
       setTimeout(function(){showlink()},speed);
     }
    
    if(window.addEventListener){
       window.addEventListener('load',showlink,false);
     }
    else { 
    if(window.attachEvent){
       window.attachEvent('onload',showlink);
      }
     }
    </script>
    
    </head>
    <body>
    
    <div><a id="link" href="http://www.ahfb2000.com/">this is the ahb forum</a></div>
    
    </body>
    </html>
    
    

  12. #27
    drose's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2009
    Posts
    7

    Re: Rotating Text/Quotes Script?

    The only problem with this is that if you set the time to say 8000 to get the quote read, it takes that long for the initial quote to load. Any thoughts as to how to get the first quote to load automatically?

  13. #28
    drose's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2009
    Posts
    7

    Re: Rotating Text/Quotes Script?

    Sorry, posted twice!

    The only thing for this is that if you set the time to 9000 so that people can read the quotes it takes that long to load the first quote. Any way around this, how do we get the initial first quote to load immediately?

  14. #29
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Rotating Text/Quotes Script?

    Hi there drose

    and a warm welcome to these forums.

    Don't worry about the double post, you were probably over excited at the time.

    This thread contains a variety of quote scripts.

    Which one, precisely, is giving you problems?

  15. #30
    drose's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2009
    Posts
    7

    Re: Rotating Text/Quotes Script?

    I am using this code:


    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>Rotating Quotes</title>

    <style type="text/css">
    body {
    color:#000;
    background-color:#aaa;
    }
    #quote {
    margin:50px auto;
    font-family:verdana,arial,helvetica,sans-serif;
    font-size:16px;
    color:#000;
    width:324px;
    line-height:40px;
    border:1px solid #000;
    background-color:#fff;
    text-align:center;
    }
    </style>

    <script type="text/javascript">

    var quotes=[
    'This is quote number one', /* add as many quotes as you like!*/
    'This is quote number two',
    'This is quote number three',
    'This is quote number four',
    'This is quote number five',
    'This is quote number six',
    'This is quote number seven',
    'This is quote number eight',
    'This is quote number nine',
    'This is quote number ten'
    ];

    function showQuote() {
    document.getElementById("quote").firstChild.nodeValue=
    quotes[Math.floor(Math.random()*quotes.length)];
    }

    if(window.addEventListener){
    window.addEventListener('load',showQuote,false);
    }
    else {
    if(window.attachEvent){
    window.attachEvent('onload',showQuote);
    }
    }
    </script>

    </head>
    <body>

    <div id="quote">&nbsp;</div>

    </body>
    </html>

    Thanks for your help!



Page 2 of 7 First 1 2 3 4 5 6 ... Last

Tags for this Thread