Web Analytics Made Easy -
StatCounter javascript dom change background color - CodingForum

Announcement

Collapse
No announcement yet.

javascript dom change background color

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • javascript dom change background color

    can someone tell me why the code below works in FIREFox but no IE?

    var td1 = window.parent.document.getElementById("td1");
    td1.setAttribute("bgcolor","#EFEFEF");


    <td id="td1" width="100" bgcolor="white" >
    <div id="message" > </div>
    </td>

    the background does not get changed in IE

    thanks for any input

  • #2
    Originally posted by khan8822 View Post
    can someone tell me why the code below works in FIREFox but no IE?

    var td1 = window.parent.document.getElementById("td1");
    td1.setAttribute("bgcolor","#EFEFEF");


    <td id="td1" width="100" bgcolor="white" >
    <div id="message" > </div>
    </td>

    the background does not get changed in IE

    thanks for any input

    element.style.backgroundColor = "color";

    Code:
    <html>
    
    <head><title></title>
    
    <script>
    function changeCell()
    {
    	var td = document.getElementById('td_2');
    	td.style.backgroundColor = "#ff0000";
    }
    </script>
    
    <body>
    <table>
    	<tr><td>td1</td></tr>
    	<tr><td id="td_2">td2</td></tr>
    </table>
    <input type="button" value="change td2" onclick="changeCell()" />
    </body>
    </html>
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

    Comment

    Working...
    X