HighDots Forums  

Setting the background color of an <li> element in a body onLoadJavascript function

Javascript JavaScript language (comp.lang.javascript)


Discuss Setting the background color of an <li> element in a body onLoadJavascript function in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Edward Diener
 
Posts: n/a

Default Setting the background color of an <li> element in a body onLoadJavascript function - 03-19-2008 , 10:02 AM






I have a body onLoad Javascript function which is being called and I
want to set the background color of an <li> element in my document which
has a unique id. I have tried various incantations such as:

document.getElementById('myLIelementID').style.bgc olor = "red";

all to no effect. Does anybody know the precise code in Javascript to
get this done ?

Reply With Quote
  #2  
Old   
Michael White
 
Posts: n/a

Default Re: Setting the background color of an <li> element in a body onLoadJavascript function - 03-19-2008 , 12:29 PM






Edward Diener wrote:
Quote:
I have a body onLoad Javascript function which is being called and I
want to set the background color of an <li> element in my document which
has a unique id. I have tried various incantations such as:

document.getElementById('myLIelementID').style.bgc olor = "red";

all to no effect. Does anybody know the precise code in Javascript to
get this done ?
Element.style.backgroundColor = "red";

Mick


Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.