Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

Reply
 
Thread Tools
Old 07-07-07, 07:37 AM   #1
technoid
Registered User
 
Join Date: Jul 2004
Location: Denton, Texas
Posts: 505
Default Table TD Background Color (javascript)

What I want to do is read the background color of a table td element, then add 101010 to it to lighten it up and then write that value to it. So far I can write a value but when I try to read it I don't get the value. I thought the background color was read/write.

I can set the color this way.

var bgclr = "#cccccc";
this.style.backgroundColor=bgclr;


But I can't read the color with this.

var bgclr=this.style.backgroundColor;

The initial background color is set in the css class.

EDIT: If I set the background color using an in-line style the read works correctly. But if I use an external css class it doesn't.
__________________
Antec-SOLO | ASUS-P5Q-SE | C2D-E8600 | AC-Freezer-7-Pro | Seasonic-S12-550W | 3GB-KVR-PC2-6400 | GTX-560Ti | SB-XtremeGamer | Pioneer-BDR-205 | Samsung-S223B | Dell-U2412M
technoid is offline   Reply With Quote
Old 07-11-07, 01:29 PM   #2
fivefeet8
Ngemu Mod
 
Join Date: Jul 2003
Location: Fresno, CA
Posts: 1,886
Default Re: Table TD Background Color (javascript)

I remember running into the same situation with a scheduling web app I created. It seems the background color attribute is only accessible if it's inline.
__________________
[i7 2600k @4.4ghertz][2x4 GB DDR3 1600][EVGA GTX570 1.280GB SC][EVGA GTX460 physx][Asrock Extreme7 Gen3 Z68][2xSeagate 160 Gb SATA HD raid0][Seagate 250 GB SATA2 HD][Sony Bravia 40' 1080p LCD HDTV][NEC 3520a DVD+-DLw][Windows 7 Ultimate x64][Rosewill 1000w]
fivefeet8 is offline   Reply With Quote
Old 07-12-07, 01:54 AM   #3
t3hl33td4rg0n
Dethklok Returns!
 
t3hl33td4rg0n's Avatar
 
Join Date: Dec 2004
Location: Kent, OH
Posts: 2,142
Send a message via AIM to t3hl33td4rg0n Send a message via MSN to t3hl33td4rg0n Send a message via Yahoo to t3hl33td4rg0n
Default Re: Table TD Background Color (javascript)

Hmm, that is odd... Are you running this on IIS or Apache? I know IIS has had problems when calling external CSS stylesheets, I don't know why, but when I switched to Apache, problem went away.

You could try calling the stylesheet before the script. Thats all I have for now
__________________


Intel QX9650 @ 3.83GHzXFX 780ieVGA GTX 560Ti8GB GSkill DDR800Creative Sound Blaster X-Fi Titanium PCI-ESeagate 1.5TB . 4x Samsung 2TB

Quote:
Originally Posted by MowTin View Post
....it's so clear how government makes things worse not better...
t3hl33td4rg0n is offline   Reply With Quote
Old 07-18-07, 10:40 AM   #4
fivefeet8
Ngemu Mod
 
Join Date: Jul 2003
Location: Fresno, CA
Posts: 1,886
Default Re: Table TD Background Color (javascript)

Quote:
Originally Posted by t3hl33td4rg0n
Hmm, that is odd... Are you running this on IIS or Apache? I know IIS has had problems when calling external CSS stylesheets, I don't know why, but when I switched to Apache, problem went away.

You could try calling the stylesheet before the script. Thats all I have for now
If he's using javascript to modify the CSS attribute, then it's on the client side. Either it's something with javascript or it's the browser. Remember, CSS and javascripts are cached locally on the client's computer.
__________________
[i7 2600k @4.4ghertz][2x4 GB DDR3 1600][EVGA GTX570 1.280GB SC][EVGA GTX460 physx][Asrock Extreme7 Gen3 Z68][2xSeagate 160 Gb SATA HD raid0][Seagate 250 GB SATA2 HD][Sony Bravia 40' 1080p LCD HDTV][NEC 3520a DVD+-DLw][Windows 7 Ultimate x64][Rosewill 1000w]
fivefeet8 is offline   Reply With Quote
Old 07-18-07, 11:59 AM   #5
technoid
Registered User
 
Join Date: Jul 2004
Location: Denton, Texas
Posts: 505
Default Re: Table TD Background Color (javascript)

Quote:
Originally Posted by fivefeet8
If he's using javascript to modify the CSS attribute, then it's on the client side. Either it's something with javascript or it's the browser. Remember, CSS and javascripts are cached locally on the client's computer.
Yes, I'm using javascript to modify it. I gave up trying to do a read/modify/write and just created two classes and changed the class using javascript.
__________________
Antec-SOLO | ASUS-P5Q-SE | C2D-E8600 | AC-Freezer-7-Pro | Seasonic-S12-550W | 3GB-KVR-PC2-6400 | GTX-560Ti | SB-XtremeGamer | Pioneer-BDR-205 | Samsung-S223B | Dell-U2412M
technoid is offline   Reply With Quote
Old 07-18-07, 01:18 PM   #6
stncttr908
Registered User
 
stncttr908's Avatar
 
Join Date: Aug 2002
Location: NJ, USA
Posts: 4,496
Send a message via AIM to stncttr908
Default Re: Table TD Background Color (javascript)

What about getVariableById()?
__________________
PC - | Core i7-2600K @ stock | Gigabyte GA-P67A-UD3 | 4GB Patriot Sector 5 DDR3 | Galaxy GTX 460 1GB @ stock | Corsair Force 120GB SSD | Seagate 1TB 7200RPM | 320GB Seagate 7200.10 | 2x Seagate 500GB USB 2.0 | Lite-On 20x SATA DVD+RW | Silverstone TJ-09 | Corsair 620W PSU | Logitech Z-5500s | Sennheiser HD-570 headphones | Samsung 2494LW |

Laptop - | Dell Inspiron 1420 | C2D T7300 (2.0GHz, 4MB cache) | 2GB DDR2-667 | 160GB 7200RPM HDD | DVD +/- RW | 14.1" WXGA+ (1440x900) | Broadcom 802.11g | NVIDIA 8400M GS 128MB |
stncttr908 is offline   Reply With Quote
Old 07-19-07, 11:58 AM   #7
fivefeet8
Ngemu Mod
 
Join Date: Jul 2003
Location: Fresno, CA
Posts: 1,886
Default Re: Table TD Background Color (javascript)

Quote:
Originally Posted by stncttr908
What about getVariableById()?
Isn't that a flash proprietary function? It's not listed in the default Javascript function list.
__________________
[i7 2600k @4.4ghertz][2x4 GB DDR3 1600][EVGA GTX570 1.280GB SC][EVGA GTX460 physx][Asrock Extreme7 Gen3 Z68][2xSeagate 160 Gb SATA HD raid0][Seagate 250 GB SATA2 HD][Sony Bravia 40' 1080p LCD HDTV][NEC 3520a DVD+-DLw][Windows 7 Ultimate x64][Rosewill 1000w]
fivefeet8 is offline   Reply With Quote
Old 07-19-07, 12:00 PM   #8
fivefeet8
Ngemu Mod
 
Join Date: Jul 2003
Location: Fresno, CA
Posts: 1,886
Default Re: Table TD Background Color (javascript)

Quote:
Originally Posted by technoid
Yes, I'm using javascript to modify it. I gave up trying to do a read/modify/write and just created two classes and changed the class using javascript.
Why didn't you use the inline CSS as that worked right? Then you could create a Javascript variable to hold the background color at runtime and modify it any way you like afterwards. You could also try accessing the CSS file directly with javascript and modify the CSS class directly instead of from a HTML element style.
__________________
[i7 2600k @4.4ghertz][2x4 GB DDR3 1600][EVGA GTX570 1.280GB SC][EVGA GTX460 physx][Asrock Extreme7 Gen3 Z68][2xSeagate 160 Gb SATA HD raid0][Seagate 250 GB SATA2 HD][Sony Bravia 40' 1080p LCD HDTV][NEC 3520a DVD+-DLw][Windows 7 Ultimate x64][Rosewill 1000w]
fivefeet8 is offline   Reply With Quote

Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Captain America Table Now Available for Zen Pinball THD News Archived News Items 0 06-28-12 06:00 PM
Mixtape Table by Jeff Skierka News Archived News Items 0 05-27-12 03:00 PM
HPCwire: Chips on the Table: Sandy Bridge versus Westmere http://t.co/qKx3ItGS #HPC # News Archived News Items 0 05-10-12 08:10 AM

All times are GMT -5. The time now is 08:37 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.