Updated code of abnormal ajaxpro2 market data

Source: Internet
Author: User
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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.