Link to home
Start Free TrialLog in
Avatar of brgivens
brgivens

asked on

BODY color?

Hi,

I'm trying to create an object with the same background color as the document.body.  I thought this would be a no brainer, but apparently not:

<html>
<style>
  body{background:#05ae55}
</style>
<head>
<script language="javascript">
  function test(){alert(document.body.style.backgroundColor);}
</script>
</head>
<body onload="test();">
</body>
</html>

What am I missing?  Surely, there's a setting which stores the actual color of the body?  I need to be able to figure out the color of the body, regardless of how it's been set.
ASKER CERTIFIED SOLUTION
Avatar of GwynforWeb
GwynforWeb
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sajuks
sajuks

change alert to document.bgColor;
HTH
Sorry GwynforWeb  didnt see your post. ( now where have i seen this message recently ;-) )
Avatar of brgivens

ASKER

Thanks... I knew it had to be something easy :)