473,403 Members | 2,222 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,403 software developers and data experts.

background style for childnodes in firefox 2.0

6
hey ,

There is this code snippet tat works perfectly in IE7 but poses prob in firefox 2.0.
This has to show a bgcolor for the row on mouseover .
function highlightOn(obj) {

var varChild, i;
for (i = 0; i < obj.childNodes.length; i+=1)
{
varChild = obj.childNodes[i];
varChild.style.backgroundColor = "#ffff00";
}
}
Error being thrown is "varChild.style" has no properties in mozilla .Could u please help me fix this one up.

Regards
Moz
Mar 26 '07 #1
5 1935
sumittyagi
202 Expert 100+
hey ,

There is this code snippet tat works perfectly in IE7 but poses prob in firefox 2.0.
This has to show a bgcolor for the row on mouseover .
function highlightOn(obj) {

var varChild, i;
for (i = 0; i < obj.childNodes.length; i+=1)
{
varChild = obj.childNodes[i];
varChild.style.backgroundColor = "#ffff00";
}
}
Error being thrown is "varChild.style" has no properties in mozilla .Could u please help me fix this one up.

Regards
Moz
whenever you find this type of error, then that means the property you are accessing is not supported or desn't exist.

try the alternative.

for (i = 0; i < obj.childNodes.length; i+=1)
{
varChild = obj.childNodes[i];
varChild.setAttribute("style", "background-color:#ffff00");
}
Mar 26 '07 #2
moz
6
hey i tried this but with tat syntax its neither working in IE7 nor in mozilla is there any other alternative?
Mar 26 '07 #3
acoder
16,027 Expert Mod 8TB
The problem is caused by whitespace. Firefox treats whitespace as a node too.

See link.
Mar 26 '07 #4
moz
6
its still nt wrking.. :(
any other solution
Mar 27 '07 #5
acoder
16,027 Expert Mod 8TB
Put everything on one line to get rid of the spaces.

Or use a stylesheet hover for the the table rows. It should work in FF, I'm not sure about IE7.
Mar 27 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Alistair Birch | last post by:
Hi I want rows of a table to appear in alternating background colours. Having looked around the web I can't find any solution apart from waiting for the next version of CSS, so I tried building...
11
by: Konrad Den Ende | last post by:
I have a function returning a string but the problem is that the color of it is blue which suits me well for some pages but not for others. Is it possible to "feel" what the color of the background...
31
by: Arthur Shapiro | last post by:
I'm the webmaster for a recreational organization. As part of one page of the site, I have an HTML "Calendar at a Glance" of the organization's events for the month. It's a simple table of a...
5
by: proximus | last post by:
Hi, I am trying to change the background of table TD's. The problem is that I have no access to the HTML code. SO I am trying to alter this using Javascript/DOM in an external .js file. I...
4
by: jarek | last post by:
Hi, this is my code: CSSStyleDeclaration.prototype.__defineSetter__('display', displaySetter); function displaySetter(value) { var parent = findParent(document, this); if (parent) {
2
by: Mark | last post by:
IE creates an object of every ID'd HTML tag (so it appears), and each object sets a property for any parameter I set in the tag. For example, my HTML might be: <td id='cell1'...
11
by: Gérard Talbot | last post by:
Hello, <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <title></title> <style type="text/css"> body {background-color: white; color: black;}...
6
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to...
2
by: willyWEB66 | last post by:
Hi everyone, I have this code in javascript where the XML file is loaded and displayed to an html using XSLT. It works fine in IE but not in Firefox. My problem is in the looping to the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.