代码
<script language="JavaScript">
function $(obj){return document.getElementById(obj);}
var isFirstA2102FEDC1CF4556H36F20959jdfFEA6F=true;//页面第一次执行加载数据但不显示边框
function ReLoadDataA2102FEDC1CF4556H36F20959jdfFEA6F()
{
Currency.Currency.GetDataSource("A2102FEDC1CF4556H36F20959jdfFEA6F",ReLoadDataResultA2102FEDC1CF4556H36F20959jdfFEA6F);
}
function ReLoadDataResultA2102FEDC1CF4556H36F20959jdfFEA6F(result){
if (result.error != null)
{
return;
}
var values = result.value;
var index=2; //显示涨跌
var tablelist=$('tableDataA2102FEDC1CF4556H36F20959jdfFEA6F');
if(values!=null){
var rowLen=tablelist.rows.length;
for(var i=1;i<rowLen;i++){
if(! isFirstA2102FEDC1CF4556H36F20959jdfFEA6F){//不是第一次运行只加载数据
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);//只显示第一,二,五列的带颜色边框
SetBorderColorA2102FEDC1CF4556H36F20959jdfFEA6F(tablelist,i,index,true);//只显示第一,二,五列的带颜色边框
}
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;//运行过一次了
}
}
function ClearBorderColorA2102FEDC1CF4556H36F20959jdfFEA6F(obj,irow,icell,boo){ //清除边框和颜色
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){ //设置边框及颜色
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){ //设置字体的颜色
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>
function $(obj){return document.getElementById(obj);}
var isFirstA2102FEDC1CF4556H36F20959jdfFEA6F=true;//页面第一次执行加载数据但不显示边框
function ReLoadDataA2102FEDC1CF4556H36F20959jdfFEA6F()
{
Currency.Currency.GetDataSource("A2102FEDC1CF4556H36F20959jdfFEA6F",ReLoadDataResultA2102FEDC1CF4556H36F20959jdfFEA6F);
}
function ReLoadDataResultA2102FEDC1CF4556H36F20959jdfFEA6F(result){
if (result.error != null)
{
return;
}
var values = result.value;
var index=2; //显示涨跌
var tablelist=$('tableDataA2102FEDC1CF4556H36F20959jdfFEA6F');
if(values!=null){
var rowLen=tablelist.rows.length;
for(var i=1;i<rowLen;i++){
if(! isFirstA2102FEDC1CF4556H36F20959jdfFEA6F){//不是第一次运行只加载数据
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);//只显示第一,二,五列的带颜色边框
SetBorderColorA2102FEDC1CF4556H36F20959jdfFEA6F(tablelist,i,index,true);//只显示第一,二,五列的带颜色边框
}
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;//运行过一次了
}
}
function ClearBorderColorA2102FEDC1CF4556H36F20959jdfFEA6F(obj,irow,icell,boo){ //清除边框和颜色
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){ //设置边框及颜色
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){ //设置字体的颜色
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>