Go Back  Xtreme Visual Basic Talk > Other Languages > Web Programming > Javascript: Get a value set by CSS


Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2008, 05:42 AM
the master's Avatar
the master the master is offline
Tachikoma
 
Join Date: Mar 2003
Location: Mansfield, UK
Posts: 4,580
Default Javascript: Get a value set by CSS

Is it possible in javascript to get a value that was set by a CSS style sheet? Aparently this should be possible but it doesnt seem to be working.

I setup a loop to check all elements on the page.
Code:
for(i=0;i<document.all.length;i++){

	alert(document.all[i].id+' '+document.all[i].className+' '+document.all[i].style.cssText);
}
I can see that it is looping through my elements correctly. When i see a class name appear i thought i should see css text too. It doesnt seem to work. I know there is CSS there because the page displays properly. The strange thing is that i do see some CSS values but not always for elements which i have set a class for.
__________________
"That which seems simple is often overlooked" ~ me
Halloween Special FX
Web Hosting from Spook Technologies
Reply With Quote
  #2  
Old 02-18-2008, 07:44 AM
the master's Avatar
the master the master is offline
Tachikoma
 
Join Date: Mar 2003
Location: Mansfield, UK
Posts: 4,580
Default

Ive had a search around the net and it seems i can use "currentStyle" instead of just "style". Aparently it isnt suported in a lot of browsers but its supported in IE6. Thats fine for me because im only writing this to suit IE6
__________________
"That which seems simple is often overlooked" ~ me
Halloween Special FX
Web Hosting from Spook Technologies
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:

Powered by liquidweb