Results 1 to 2 of 2

Thread: style.backgroundColor returning empty string

  1. #1
    Join Date
    Nov 2009
    Posts
    3

    style.backgroundColor returning empty string

    PHP Code:
    echo "<div id='d1' onclick=\"alert(this.style.backgroundColor)\" width='100%'>content</div>"
    This line of code is working but for some reason it is returning an empty string. I have set the css background color of the div in internal(not inline) css above the div. What am I missing here?

    Thanks,
    NewTechGuy

  2. #2
    Join Date
    Oct 2009
    Posts
    64

    Thumbs up

    At first I thought you needed to use background-color, but I was wrong. If you use inline styles, your command will work, but it's not grabbing it from the stylesheet. I've had that problem before. Doing some more research.

Similar Threads

  1. encrypt and decrypt query string
    By vannova in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 05 Jun 2007, 07:59 AM
  2. eval() if the string isn't 100% PHP code?
    By compuXP in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 18 Jul 2005, 05:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •