与IE的Perf概率 [英] Perf prob with IE

查看:84
本文介绍了与IE的Perf概率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:


我们有一张约2400个单元格的表格。我们的要求是每隔5秒突出显示数据已更改的表格中的单元格。我们的

脚本在Firefox中表现相对不错,但IE中的性能非常糟糕。附上了一个模拟概率的简单html。非常感谢任何关于如何提高IE中的性能的

输入。


谢谢,

Raj

---

< HTML>

< HEAD>

< style>

.normal_td {background-color:#DDDDDD}

.red_td {background-color:#FF0000}

.blue_td {background-color:#0000FF}

< / style>

< script language =" JavaScript1.2">

var kk = 100;

函数updateTableCells()

{

var tbl = document.getElementById(" tbl");

var tds = tbl.getElementsByTagName(" td");


for(var k = 0; k< tds.length; k ++)

{

tds [k] .firstChild.nodeValue = kk;

var rem = kk-(parseInt(kk / 7)* 7);


if(rem == 0)

setClassName(tds [k]," red_td");

else if(rem == 5)

setClassName(tds [k]," normal_td");

else if(rem == 2)

setClassName(tds [k]," blue_td");

else

setClassName(tds [k],null);

kk ++;

if(kk> 10000)kk = 5000;

}

}


函数setClassName(n,name){

if(n.className!= name)

n.className = name;

}


函数init(){

var str ="< table id =''tbl''>" ;

for(var i = 0; i< 150; i ++)

{

str + ="< tr> \ n" ;;

for(var j = 0; j< 16; j ++)

{

str + ="< td id =' 'ele'+ i +" _" + j +"''>" + j +"< / td> \ n" ;;

}

str + ="< / tr> \ n" ;;

}

str + ="< / table>" ;;

var bod = document.getElementById(" bod");

bod.innerHTML = str;

setInterval(''updateTableCells()'', ''5000'');

}


window.onload = init;

< / script>

< / HEAD>

< BODY id =" bod" />

< / HTML>

Hello all:

We have a table with about 2400 cells. Our requirement is to highlight
the cells in the table whose data has changed, every 5 seconds. Our
script behaves relatively ok in Firefox, but the performance in IE
really bad. Have attached a simple html which simulates the prob. Any
inputs on how to improve the perf in IE are greatly appreciated.

Thanks,
Raj
---
<HTML>
<HEAD>
<style>
.normal_td { background-color: #DDDDDD }
.red_td { background-color: #FF0000 }
.blue_td { background-color: #0000FF }
</style>
<script language="JavaScript1.2">
var kk=100;

function updateTableCells()
{
var tbl = document.getElementById("tbl");
var tds = tbl.getElementsByTagName("td");

for(var k=0; k<tds.length;k++)
{
tds[k].firstChild.nodeValue = kk;
var rem = kk-(parseInt(kk/7)*7);

if(rem == 0)
setClassName(tds[k], "red_td");
else if(rem==5)
setClassName(tds[k], "normal_td");
else if(rem==2)
setClassName(tds[k], "blue_td");
else
setClassName(tds[k], null);
kk++;
if(kk>10000)kk=5000;
}
}

function setClassName(n, name){
if(n.className!=name)
n.className=name;
}

function init(){
var str="<table id=''tbl''>";
for (var i=0;i<150;i++)
{
str+="<tr>\n";
for (var j=0;j<16;j++)
{
str+="<td id=''ele"+i+"_"+j+"''>"+j+"</td>\n";
}
str+="</tr>\n";
}
str +="</table>";
var bod = document.getElementById("bod");
bod.innerHTML=str;
setInterval(''updateTableCells()'',''5000'');
}

window.onload = init;
</script>
</HEAD>
<BODY id="bod"/>
</HTML>

推荐答案

Raj于2004年12月6日在comp.lang.javascript中写道< b> :
Raj wrote on 06 dec 2004 in comp.lang.javascript:
我们有一个包含大约2400个单元格的表。我们的要求是每隔5秒突出显示数据已更改的表格中的单元格。我们的
脚本在Firefox中表现相对较好,但在IE中的表现确实很糟糕。附上了一个模拟概率的简单html。非常感谢任何关于如何提高IE中的性能的
输入。
We have a table with about 2400 cells. Our requirement is to highlight
the cells in the table whose data has changed, every 5 seconds. Our
script behaves relatively ok in Firefox, but the performance in IE
really bad. Have attached a simple html which simulates the prob. Any
inputs on how to improve the perf in IE are greatly appreciated.




< td> s不会自行更改,

但如果你的意思是改变 < input> s由用户更改,

尝试IE:


输入{background-color:expression(value!= defaultValue?" cyan" ;:"");}


我不知道表达式()语法的性能损失与这样的

傻大数字< input> s



<td>s do not change by themselves,
but if you mean by "changed" <input>s changed by the user,
try for IE:

input { background-color:expression(value!=defaultValue?"cyan":"");}

I don''t know the performance loss of the expression() syntax with such an
silly large number of <input>s


您好Evertjan:


每5秒从服务器下载新数据。下载的

数据将与

表中当前显示的数据进行比较。如果任何单元格已更改,则javascript将更新单元格的

值,并根据

更改是否为先前值的正值或负值更改单元格颜色。

Hi Evertjan:

Every 5 secs fresh data is downloaded from the server. The downloaded
data is compared against the data currently being displayed in the
table. If any of the cells have changed, the javascript updates the
value of the cell and changes the cell color based on whether the
change is positive or negative from the previous value.





只有2400? :0

http:// www.peachpit.com/articles/article.asp?p=31567


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励为它!


Only 2400? :0

http://www.peachpit.com/articles/article.asp?p=31567

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于与IE的Perf概率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆