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

E

Edward Diener

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.bgcolor = "red";

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top