I'm looking for a snippet of code that would let me generate testimonials, quotes or any string value randomly on a webpage. I would like for it be standards compliant, XML based(meaning I would store the testimonials in an xml file), and the less obtrusive it is, the better.
Where could I download such a thing or is there an example out there? I pretty much googled around, but had no luck. Also, I tried modifying the Ajax Ticker seen here:
http://www.dynamicdrive.com/dynamicindex17/rsstickerajax/index.htm
If you want to attempt to solve this on your own instead of providing me a link, here's what I got:
I have a div tag in my body tag with the id 'testimonials' with this javascript code inside it:
<script type="text/javascript">
var xmlfile="tickercontent/ticker_office.txt" //path to ticker txt file on your server.
//ajax_ticker(xmlfile, divId, divClass, delay, optionalfadeornot)
new ajax_ticker(xmlfile, "ajaxticker1", rotate() )
</script>
That just basically establishes where the xml file is located and loads it with the external javasript file and my function which is inside that ext javascript file called "rotate()"
inside that "rotate()" function, I have code similar to this:
var randomizeMessage= xmldata
var randomizedTicker = math.random(randomizeMessage)
document.getElementById("testimonials").innerHTML = randomizedTicker
Any idea how I could load what's inside a class called "message" (which would be in a external xml file) into a webpage randomly?