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
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top