Code < Script Language = " Javascript " >
Function $ (OBJ ){ Return Document. getelementbyid (OBJ );}
VaR Isfirsta2102fedc1cf4556h36f20959jdffea6f = True ; // The page loads data for the first time but does not display a border
Function Reloaddataa2102fedc1cf4556h36f20959jdffea6f ()
{
Currency. Currency. getdatasource ( " A2102fedc1cf4556h36f20959jdffea6f " , Reloaddataresulta2102fedc1cf4556h36f20959jdffea6f );
}
Function Reloaddataresulta2102fedc1cf4556h36f20959jdffea6f (result ){
If (Result. Error ! = Null )
{
Return ;
}
VaR Values = Result. value;
VaR Index = 2 ; // Show rise/fall
VaR Tablelist = $ ( ' Tabledataa2102fedc1cf4556h36f20959jdffea6f ' );
If (Values ! = Null ){
VaR Rowlen = Tablelist. Rows. length;
For ( VaR I = 1 ; I < Rowlen; I ++ ){
If ( ! Isfirsta2102fedc1cf4556h36f20959jdffea6f ){ // It is not the first time to load data only
If (Tablelist. Rows [I]. cells [Index]. innerhtml ! = Values. Rows [I - 1 ] [Values. Columns [Index - 1 ]. Name]) {
If (Values. Rows [I - 1 ] [Values. Columns [Index - 1 ]. Name] > 0 ){
Setbordercolora2102fedc1cf4556h36f20959jdffea6f (tablelist, I, 1 , True ); // Show only the first, second, and fifth columns with colored borders
Setbordercolora2102fedc1cf4556h36f20959jdffea6f (tablelist, I, index, True ); // Show only the first, second, and fifth columns with colored borders
}
Else {
Setbordercolora2102fedc1cf4556h36f20959jdffea6f (tablelist, I, 1 , False );
Setbordercolora2102fedc1cf4556h36f20959jdffea6f (tablelist, I, index, False );
}
Window. setTimeout (clearbordercolora2102fedc1cf4556h36f20959jdffea6f (tablelist, I, 1 , True ), 3000 );
Window. setTimeout (clearbordercolora2102fedc1cf4556h36f20959jdffea6f (tablelist, I, index, False ), 3000 );
}
}
For ( VaR X = 1 ; X < 7 ; X ++ ){
Tablelist. Rows [I]. cells [X]. innerhtml = Values. Rows [I - 1 ] [Values. Columns [x - 1 ]. Name];
}
If (Values. Rows [I - 1 ] [Values. Columns [Index - 1 ]. Name] > 0 )
Settextcolora2102fedc1cf4556h36f20959jdffea6f (tablelist, I, index, True );
Else
Settextcolora2102fedc1cf4556h36f20959jdffea6f (tablelist, I, index, False );
}
Isfirsta2102fedc1cf4556h36f20959jdffea6f = False ; // Run Once
}
}
Function Clearbordercolora2102fedc1cf4556h36f20959jdffea6f (OBJ, irow, icell, boo ){ // Clear borders and colors
Return Function (){
VaR Bcolor = OBJ. Rows [irow]. bgcolor;
If ( True )
OBJ. Rows [irow]. cells [icell]. style. Border = " 1px solid " + Bcolor;
If (BOO)
OBJ. Rows [irow]. cells [icell]. style. Color = " #000000 " ;
}
}
Function Setbordercolora2102fedc1cf4556h36f20959jdffea6f (OBJ, irow, icell, boo ){ // Set borders and colors
If (BOO ){
If ( True )
OBJ. Rows [irow]. cells [icell]. style. Border = " 1px solid red " ;
OBJ. Rows [irow]. cells [icell]. style. Color = " Red " ;
}
Else {
If ( True )
OBJ. Rows [irow]. cells [icell]. style. Border = " 1px solid green " ;
OBJ. Rows [irow]. cells [icell]. style. Color = " Green " ;
}
}
Function Settextcolora2102fedc1cf4556h36f20959jdffea6f (OBJ, irow, icell, boo ){ // Set the font color
If (BOO)
OBJ. Rows [irow]. cells [icell]. style. Color = " Red " ;
Else
OBJ. Rows [irow]. cells [icell]. style. Color = " Green " ;
}
Reloaddataa2102fedc1cf4556h36f20959jdffea6f ();
Window. setinterval (reloaddataa2102fedc1cf4556h36f20959jdffea6f, 30000 );
< / SCRIPT>