473,406 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Speed up onmouseover of rows and cols

This code from siteexperts.com tends to be slow onmouseover if you get
more than a 50 rows. Suggestions for increasing speed?

http://www.siteexperts.com/tips/styles/ts25/page1.asp

Thanks, John

var rowHighlight = true // turn on row highlights
var colHighlight = true // turn off row highlights

function getElement(el) {
var tagList = new Object
for (var i = 1; i < arguments.length; i++)
tagList[arguments[i]] = true
while ((el!=null) && (tagList[el.tagName]==null))
el = el.parentElement
return el
}

function checkHighlight(which) {
var el = getElement(event.srcElement,"TH","TD")
if (el==null) return
if ((el.tagName=="TH") && (colHighlight)) {
var idx = el.cellIndex
var table = getElement(el, "TABLE")
var column = table.all.tags("COL")[idx]
if (which)
column.className="cover"
else
column.className=""
}
if ((el.tagName=="TD") && (rowHighlight)) {
var row = getElement(el, "TR")
var table = getElement(row, "TABLE")
if (which)
row.className = "rover"
else
row.className = ""
cache = row
}
}
Jul 23 '05 #1
6 1515
On 22/9/04 12:05 pm, johkar wrote:
This code from siteexperts.com tends to be slow onmouseover if you get
more than a 50 rows. Suggestions for increasing speed?

http://www.siteexperts.com/tips/styles/ts25/page1.asp


What is it supposed to do? In IE5.1 the runtime errors occur pretty much
instantaneously when you move your mouse over the table. You need faster
errors, or what?

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 23 '05 #2
johkar wrote:
This code from siteexperts.com tends to be slow onmouseover if you get
more than a 50 rows. Suggestions for increasing speed?

http://www.siteexperts.com/tips/styles/ts25/page1.asp if (which)
column.className="cover"
else
column.className=""


Setting the className property is much more expensive than setting a
simple style property! Try switching to style updates instead of
className updates.

Also, passing the 'this' value to the functions, and minimizing node
lookups, could be a good idea. On a different level, rewriting the
script and using caching systems may be interesting (removing mouseout
handler).
HTH,
Yep.
Jul 23 '05 #3
Yann-Erwan Perio wrote:
Setting the className property is much more expensive than setting a
simple style property!


Why should it?
PointedEars
--
"A low voter turnout is an indication
of fewer people going to the polls."
-- Dan Quayle

Jul 23 '05 #4
On Sun, 03 Oct 2004 21:34:15 +0200, Thomas 'PointedEars' Lahn
<Po*********@web.de> wrote:
Yann-Erwan Perio wrote:
Setting the className property is much more expensive than setting a
simple style property!


Why should it?


because the CSS cascade needs to be re-computed.

Jim.
Jul 23 '05 #5
Jim Ley wrote:
Thomas 'PointedEars' Lahn wrote:
Yann-Erwan Perio wrote:
Setting the className property is much more expensive than
setting a simple style property!

Why should it?


because the CSS cascade needs to be re-computed.


As it would be if the "style" property/attribute changes.
That property/attribute is not off the cascade.
PointedEars
Jul 23 '05 #6
On 5 Oct 2004 10:18:29 GMT, "Thomas 'PointedEars' Lahn"
<Po*********@web.de> wrote:
Jim Ley wrote:
Thomas 'PointedEars' Lahn wrote:
> Yann-Erwan Perio wrote:
> > Setting the className property is much more expensive than
> > setting a simple style property!
> Why should it?


because the CSS cascade needs to be re-computed.


As it would be if the "style" property/attribute changes.
That property/attribute is not off the cascade.


Except of course setting a single property on a style doesn't need to
compute as much of the cascade (inline style can only influence direct
descendants, class can of course do much more.)

Jim.
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

68
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
1
by: den2005 | last post by:
Hi everybody, I am confused and still looking why this codes is not working. Can anyone notice or know why this code is not working? Thanks in advance. Code working: <form id="form1"...
0
by: jceddy | last post by:
Hi...I hope I am posting this in an appropriate place...if not, could some direct me to someplace better? Anyway, the problem I have is that I have a page with a table with two rows. The top...
19
by: vunet.us | last post by:
Hello, My AJAX application paints data into about 500 cells with unique ID every 10 seconds. I am using document.getElementById() to find the right cell. However, I have noticed that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.