<?xml version="1.0"?>
<rss version="2.0">
 <channel>
  <title>Retrieving css values via javascript | WPDFD.com Forums</title>
  <link>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/</link>
  <description>A Scripting forum thread at WPDFD.com</description>
  <language>en-us</language>
  <pubDate>01/15/05, 015 34 2005 2005:%i:1105821298 15:34:58</pubDate>
  <lastBuildDate>06/07/13, 158 26 2013 2013:%i:1370589990 03:26:30</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>NineLabs Framework Feed Generator</generator>
  <managingEditor>sitemaster@wpdfd.com</managingEditor>
  <webMaster>sitemaster@wpdfd.com</webMaster>
     <item>
    <title>David  said:</title>
    <link>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1715</link>
    <description><![CDATA[Hi guys,<br /><br />I know you can change CSS values by using:<br /><br /><i>var doodhah = document.getElementById('name')<br />doodah.style.value = 'value'</i><br /><br />But what do I do if I want to find out what the value of <i>doodah.style.value</i> already is?]]></description>
    <pubDate>01/15/05, 015 34 2005 2005:%i:1105821298 15:34:58</pubDate>
    <guid>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1715</guid>
   </item>
     <item>
    <title>Joe Gillespie said:</title>
    <link>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1716</link>
    <description><![CDATA[Try<br /><br />var dsv=doodah.style.value]]></description>
    <pubDate>01/16/05, 016 34 2005 2005:%i:1105875297 06:34:57</pubDate>
    <guid>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1716</guid>
   </item>
     <item>
    <title>David  said:</title>
    <link>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1717</link>
    <description><![CDATA[hmm, that didn't work.<br /><br />I also tried putting it into a function but that didn't work either. &nbsp;I'll paste the relevant code below. &nbsp;(For the time being I've put the values directly into the script but I changed the first element in the array to show what I'd <i>like</i> to do).<br /><br /><code>var homeInfo = document.getElementById('home');<br /> &nbsp; &nbsp; &nbsp;var homeBgCol = homeInfo.style.backgroundColor;<br /><br /> &nbsp; &nbsp; &nbsp;bgCol[1] = [homeBgCol];<br /> &nbsp; &nbsp; &nbsp;bgCol[2] = ['#aa7a00'];<br /> &nbsp; &nbsp; &nbsp;bgCol[3] = ['#dab372'];<br /> &nbsp; &nbsp; &nbsp;bgCol[4] = ['#bc8860'];</code><br /><br />If I examine the js console in Firefox I get told:<br /><br />Error: homeInfo has no properties.<br /><br />Of course, it does have properties and the same code works fine elsewhere in the script. &nbsp;The relevant css is reproduced below:<br /><br /><code>#home<br />{<br /> &nbsp;position: absolute;<br /> &nbsp;height: 1.1em;<br /> &nbsp;width: auto;<br /> &nbsp;margin-top: 1em;<br /> &nbsp;margin-left: 0px;<br /> &nbsp;margin-right: 0px;<br /> &nbsp;background-color: #ca7e02<br />}</code>]]></description>
    <pubDate>01/16/05, 016 32 2005 2005:%i:1105911137 16:32:17</pubDate>
    <guid>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1717</guid>
   </item>
     <item>
    <title>Baxter  said:</title>
    <link>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1718</link>
    <description><![CDATA[I'm pretty dim when it comes to js, but I think you want background instead of backgroundcolor, and I think you need something after background to refer to the array.]]></description>
    <pubDate>01/17/05, 017 36 2005 2005:%i:1105972614 09:36:54</pubDate>
    <guid>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1718</guid>
   </item>
     <item>
    <title>David  said:</title>
    <link>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1719</link>
    <description><![CDATA[backgroundColor is right because it works elsewhere in the script. &nbsp;I think background is for an image.<br /><br />I didn't relate all of the code above but I've got a function calling the array elements later on in the script which actually sets the stuff. &nbsp;That works fine as well. &nbsp;The script works fine if I put the values directly into the array; it's only when I try to call the colours from the CSS that I run into problems. &nbsp;It's doesn't matter too much having the colours described in the script but I'd rather keep them in the CSS where they idealy belong.<br /><br />I don't understand why the parser returns that error either because I have similar code elsewhere in the script that produces no such error.]]></description>
    <pubDate>01/17/05, 017 41 2005 2005:%i:1105983711 12:41:51</pubDate>
    <guid>http://www.wpdfd.com/forums/wpdfd/scripting/retrieving_css_values_via_javascript/#p1719</guid>
   </item>
   </channel>
</rss