codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Live Scoreboard  Archive Import (Brad) at 22:38 on Thursday, October 31, 2002
 

Hi Everyone,

I am looking for some help with building a live scoreboard for a sports website. Here is what I need...

The scoreboard will need to work like ones that are found on such sporting sites like NBA, NFL, MLB etc etc

From a users perspective they will go to a page and view the game as it happens this page will need to continuely check (or poll) if a new entry has been added to the DB, if it finds a new entry it will display the entry with such things as score, time (ie the time left in the game or when the play was made such as 5min jordan goes for the drive and is fouled) and a brief transcript.

The information will be entered by an administrator or sports commentator who will type the plays as they happen and submit them to the DB.

Now all this looks very much like a Guestbook but it needs to be a little smarter than that.

Alternatively if someone nows of such a product I can use or buy i would appreciate it.

Your Help on this matter is greatly appreciated.

Regards

Brad

  Re: Live Scoreboard  Max at 20:15 on Saturday, February 07, 2004
 

Hi Brad

I am looking for a simmilar solution.

If you have found any please let me know.

Tnx
Max

  Re: Live Scoreboard  Troy Wolf at 01:01 on Monday, February 23, 2004
 

I'm not providing a complete code example, but rather some ideas at this time.

Building Blocks
JavaScript has a setTimeout() function that is commonly used to make sections or entire web pages update at regular intervals.

The HTML IFRAME element is used to insert a web page within a webpage. Using its attributes and style, it can be sized to as small as a single character without any frames or other noticeable characteristics.

ASP on your webserver. As you know, ASP pages can be data-driven to produce HTML output that is current with whatever data sources you are using.

The Strategy
I use this strategy a lot actually. You'll have a webpage with a section (or 2 or 3...) that you want to update every 30 seconds with current data. But you do not want the entire page to reload every 30 seconds. So what you do is use borderless IFRAMES sized just to fit your dynamic content. Make the source of those IFRAMES an ASP page that only returns the dynamic content. (In your case, the game's score, etc.) That ASP should return one more thing: a javascript section that includes a function to reload the page every 30 seconds.

The Result
A web page with sections that automatically update at regular intervals independant of the main page. Only the IFRAMES will blink when they reload. Depending on how fast they load, you may not even notice the blink during reload. Since each IFRAME has it's own reload frequency, you can have some sections that update every minute while others may update every 15 seconds.

You'll still have the limitation of the browser environment--it's not an active connection to live data. So all you can do is force refresh at specified intervals. And you can't set your refresh interval to a rate faster than your ASP script can process and return results. For example, 5 seconds would be too fast unless you only have a very low number of users and your script and server are fast. I think a Java Applet could work more as a live app, but that's completely out of my skill range. (Note: Java and Javascript are not even related.)
Troy Wolf: site expert
SnippetEdit Website Editor









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Need Javascript Multiple sidebar menu with sliding effects
•  Getting an action from a changed number ?
•  Re: How to open a MS Word document from Javascript
•  Re: adding a querystring parameter in a button click event
•  Re: onclick thumbnail images in gridview or datalist
•  Re: need help with main()
•  Re: c# .net Exception of type System.StackOverflowException was thrown.
•  Re: Plz its urgent:validation code
•  Re: The Dim appExcel As Excel.Application doesn`t work ????


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2011