JavaScript Help: Dynamic Quotes Engine Example - Using Visual Transistion Filter

This example illustrates one way to create a dynamic quotes engine using JavaScript. Some "cool" features are that it uses a named HTML container as the receptacle for the quotes. A function slurps in the quotes within the source tag and splits them using "{}" as a delimiter. This creates an array (that's a "list" to us normal folks) which is then used to select a quote from randomly. The example refreshes continuously while the web page is visible in a visitor's browser, uh... provided they haven't disabled JavaScript. Another "coolism" is the incorporation of an MS transistion filter which (in Internet Explorer) applies a visual effect between quote changes. The filter is a proprietary Microsoft thing, but for those who prefer self inflicted pain to an enjoyable web surfing experience, the filter fails in a friendly fashion. Meaning, it won't throw up errors in other browsers or prevent the rest of the sibling script used by the quotes engine from chugging along happily oblivious to the lack of filter support. (In fairness: I switched to Firefox.. so I don't generally see the filter unless I'm feeling lucky enough to dodge spyware infection via an apparently unending plethora of security flaws in "that other browser".)

If you'd like to use this script, or use it as the basis of another script which you are creating... have at it. You can simply cut/paste the code into a page where you want it and tweak away.

An Aside: Search engines, be they good or evil, are a critical element to making your web page known to others beyond the sound of your own voice. Search engines, for all the hype, are pretty stupid. As of this writing, they do not appear to read or evaluate JavaScript (and probably a massive collection of other really useful stuff too). So, if you are using JavaScript to generate a quotes engine, you may be afraid that the quotes (which are likely to be one of the better known elements of your page, at least depending on their popularity) will not be part of the indexing basis. Welp! This example gets around that problem. Remember how the quotes occupy an regular HTML container? Hey, what do you know?!, Search engines parse through HTML tags. So, a quotes engine constructed in this fashion -should not- be penalized as having searchable content obscured by those nastily confusion Java...Script... constructs.





Example:
Seconds:
How you like me now? ~OG
{} How you like me now? ~Father OG {} He didn't tell me how to live; he lived, and let me watch him do it. ~Clarence Budington Kelland {} My father used to play with my brother and me in the yard. Mother would come out and say, "You're tearing up the grass." "We're not raising grass," Dad would reply. "We're raising boys." ~Harmon Killebrew {} One father is more than a hundred Schoolemasters. ~George Herbert, Outlandish Proverbs, 1640 {} Fatherhood is pretending the present you love most is soap-on-a-rope. ~Bill Cosby {} It is not flesh and blood but the heart which makes us fathers and sons. ~Johann Schiller {} A father carries pictures where his money used to be. ~Author Unknown {} “To me, clowns aren't funny. In fact, they're kind of scary. I've wondered where this started and I think it goes back to the time I went to the circus, and a clown killed my dad.” ~Jack Handey {} When I was a boy of fourteen, my father was so ignorant I could hardly stand to have the old man around. But when I got to be twenty-one, I was astonished at how much he had learned in seven years. ~Mark Twain, "Old Times on the Mississippi" Atlantic Monthly, 1874 {} “You know when you're young, you think your dad's Superman. Then you grow up and you realize he's just a regular guy who wears a cape.” ~Dave Atell {} There's something like a line of gold thread running through a man's words when he talks to his daughter, and gradually over the years it gets to be long enough for you to pick up in your hands and weave into a cloth that feels like love itself. ~John Gregory Brown, Decorations in a Ruined Cemetery, 1994 {} Never raise your hand to your kids. It leaves your groin unprotected. ~Red Buttons {} My father gave me the greatest gift anyone could give another person, he believed in me. ~Jim Valvano: Family Quotes {} Spread the diaper in the position of the diamond with you at bat. Then fold second base down to home and set the baby on the pitcher's mound. Put first base and third together, bring up home plate and pin the three together. Of course, in case of rain, you gotta call the game and start all over again. ~Jimmy Piersal, on how to diaper a baby, 1968 {} "I talk and talk and talk, and I haven't taught people in 50 years what my father taught by example in one week." -- Mario M(atthew) Cuomo (b. 1932), Governor of NY {} I watched a small man with thick calluses on both hands work 15 and 16 hours a day. I saw him once literally bleed from the bottoms of his feet, a man who came here uneducated, alone, unable to speak the language, who taught me all I needed to know about faith and hard work by the simple eloquence of his example. -- Mario Cuomo, former governor of New York


Code for the example

Other keywords and common misspellings: javascript quotes engine java script dynamic quotes