Grow your CSS skills. Land your dream job.

need help….

  • # May 19, 2009 at 1:55 am

    I m using a script for randomly calling a text on my page using

    Code:
    Math.floor(Math.random()*(quotes.length))

    this code running perfectly when i click on my page or refresh it… is that possible to autorate the quotes after sometime

    u can see the live example playbackgroup.com right panel in top box where quotes are coming

    # May 19, 2009 at 2:25 pm

    I’m lost. Can you define "autorate" ?

    # May 19, 2009 at 2:39 pm
    "AshtonSanders" wrote:
    I’m lost. Can you define "autorate" ?

    I think he means rotate. ie. Refresh the quote after a specified amount of time.

    # May 26, 2009 at 1:00 am

    i mean refreshing a quote automatically after sometime

    # May 26, 2009 at 2:07 am
    Code:
    function rotateQuotes()
    {
    Math.floor(Math.random()*(quotes.length))
    setTimeout(“rotateQuotes()”,100000);
    }

    try this let me know if this helps u

    # May 26, 2009 at 4:32 am

    At the moment you are just ouputting the quote from javascript using document.write – but you can’t change existing text using document.write, as it only adds contents to the page. You should really learn a DOM manipulation library like jQuery, it really makes doing this kind of thing a lot easier.

    With jQuery your function might look like the following (including cssfreaks changes):

    HTML:

    Code:

    What the world thinks?

    Javascript:

    Code:
    function rotateQuotes() {
    var whichquote = Math.floor(Math.random()*(quotes.length));
    $(‘#quote’).html(quotes[whichquote]);
    setTimeout(“rotateQuotes()”,100000);
    }

    By the way you can only have one <h1> per page, so you should really change those to h2 or h3.

    # May 28, 2009 at 12:49 am

    hi daves,
    i told u in my last post tht u r really a GENIUS.. :D

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".