GUI Components JavaScript DHTML




JavaScript Ticker (using Tabular Data Control)


.tickerStyle{font-family:verdana,arial,helvetica; color:#666699; font-weight:bold; font-size:8pt; background:#EEEEFF; border-right:#666699 solid 2px; border-left:#666699 solid 1px; border-top:#666699 solid 1px; border-bottom:#666699 solid 2px; padding:3px; width:400px; text-align:center; text-decoration:none}
.tickerStyle:hover{font-family:verdana,arial,helvetica; color:#666699; font-weight:bold; font-size:8pt; background:#DDDDEE; border-right:#666699 solid 1px; border-left:#666699 solid 2px; border-top:#666699 solid 2px; border-bottom:#666699 solid 1px; padding:3px; width:400px; text-align:center; text-decoration:none}




// JavaScript Ticker
// - using Tabular Data Control
// (c) 2002 Premshree Pillai
// http://www.qiksearch.com
// qiksearch@rediffmail.com
function TDC_Ticker(objName, divName, counter, maxMsgs, timeOut)
{
 try
 {
  eval('tickerSet=' + objName + '.recordset');
  if(!tickerSet.EOF && counter  {
   tickerSet.MoveNext();
   counter++;
  }
  else
  {
   counter=0;
   tickerSet.MoveFirst();
  }
  setTimeout("TDC_Ticker('"+objName+"','"+divName+"','"+counter+"','"+maxMsgs+"','"+timeOut+"')", timeOut); 
 }
 catch(e)
 {
  alert('This Ticker works with IE 5+ only.');
 }
}




JavaScript Ticker
using Tabular Data Control





   
   
   
   


   


 var tickerMaxMsgs=4; // Maximum Messages in the Data File
 var tickerCount=tickerMaxMsgs;
 new TDC_Ticker('ticker','tickerDiv',tickerCount,tickerMaxMsgs,2000); // Set the Ticker





   
   
This JavaScript Ticker is an example of "Data Binding" using "Tabular Data Control (TDC)" which is a Microsoft ActiveX control built in to Internet Explorer.


   To include this ActiveX control, you must use the <OBJECT> tag with CLASSID as 
"CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83". To include such a ticker, you must first place the following <STYLE> and JavaScript in the <HEAD> section :


   


.tickerStyle{font-family:verdana,arial,helvetica; color:#666699; font-weight:bold; font-size:8pt; background:#EEEEFF; border-right:#666699 solid 2px; border-left:#666699 solid 1px; border-top:#666699 solid 1px; border-bottom:#666699 solid 2px; padding:3px; width:400px; text-align:center; text-decoration:none}
.tickerStyle:hover{font-family:verdana,arial,helvetica; color:#666699; font-weight:bold; font-size:8pt; background:#DDDDEE; border-right:#666699 solid 1px; border-left:#666699 solid 2px; border-top:#666699 solid 2px; border-bottom:#666699 solid 1px; padding:3px; width:400px; text-align:center; text-decoration:none}




// JavaScript Ticker
// - using Tabular Data Control
// (c) 2002 Premshree Pillai
// http://www.qiksearch.com
// qiksearch@rediffmail.com
function TDC_Ticker(objName, divName, counter, maxMsgs, timeOut)
{
 try
 {
  eval('tickerSet=' + objName + '.recordset');
  if(!tickerSet.EOF && counter  {
   tickerSet.MoveNext();
   counter++;
  }
  else
  {
   counter=0;
   tickerSet.MoveFirst();
  }
  setTimeout("TDC_Ticker('"+objName+"','"+divName+"','"+counter+"','"+maxMsgs+"','"+timeOut+"')", timeOut); 
 }
 catch(e)
 {
  alert('This Ticker works with IE 5+ only.');
 }
}


   

Here is the description of the arguments that the function TDC_Ticker() takes:
   

objName : The ID of the OBJECT where you include the TDC for that ticker.
   
divName : The ID of the element where the messages will tick.
   
counter : A counter that should be initialised to the max number of messages.
   
maxMsgs : The max number of messages in the data file.
   
timeOut : The delay (in milliseconds) between messages.
   

Next, you must place the code for placing the ticker. For e.g, the code for placing the above ticker is :


   



   
   
   
   


   


 var tickerMaxMsgs=4; // Maximum Messages in the Data File
 var tickerCount=tickerMaxMsgs;
 new TDC_Ticker('ticker','tickerDiv',tickerCount,tickerMaxMsgs,2000); // Set the Ticker



   

Here is the list of Parameters the <OBJECT> takes :
   

DataURL : The path of the file that contains the data.
   
UseHeader : This is always set to TRUE.
   
TextQualifier : The character at the beginning and end of a message.
   
FieldDelim : The Field Delimiter.


   Click here to see the data file (tickerData.txt) used for the above ticker.


   





   
   
   
   


   


 var cpyMaxMsgs=2; // Maximum Messages in the Data File
 var cpyCount=cpyMaxMsgs;
 new TDC_Ticker('cpy','cpyDiv',cpyCount,cpyMaxMsgs,4000); // Set the Ticker



document.write('' + document.lastModified + '');


           
       
ticker_tdc.zip( 2 k)