Help - Search - Members - Calendar
Full Version: news ticker? i guess?
Pixel2Life Forum > Help Section > PHP, ASP, MySQL, JavaScript and other Web/Database Programming Help
er0x
ok so i have a project for work and i kinda dont know where to get started on it.

i need a news ticker. sort of like a rss feed but what i put in the database.

i need it to update every 10 seconds and sort through the last 10 entries from a database.

can you help point me in a direction with the updating every 10 seconds?
Neil
So it has to update in the user's browser every 10 seconds?

Install jquery and do something like:
CODE
$(document).ready(function()
{
// Update the news every 10000 microseconds (check the doc to see how many seconds this is)
setInterval(update_news, 10000)

update_news();

});

function update_news()
{
$("#news").load("/news/");
};


Now this add a div on your website like: <div id="news">Loading...</div>

Once the page is rendered it will place all the html from /news/ into that div.

I didn't test any of that syntax so I can't 100% guarantee it would work, but its a start.

cheers

References:
http://docs.jquery.com/Downloading_jQuery
http://docs.jquery.com/Ajax
http://docs.jquery.com/Ajax/load#urldatacallback
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.