Click to See Complete Forum and Search --> : Syntax help - dynamically writing a table's background image


bunner bob
01-01-2003, 10:24 PM
Okay - now that I've got the dynamic background color thing, it ought to be simple to dynamically write a background IMAGE for a table - right?

It seemed like this would work
document.getElementById("proxytable").style.backgroundImage.src = 'images\/cube.gif';

or this
document.getElementById("proxytable").style.backgroundImage = 'images\/cube.gif';

or maybe this
document.getElementById("proxytable").style.background.src = 'images\/cube.gif';

but I just ain't gettin' it - I know there's some dumb syntax error I'm making. Wish I could find a comprehensive reference that would show usage of all these things.

Any ideas?

Rick Bull
01-02-2003, 07:09 AM
Try this:


document.getElementById("proxytable").style.backgroundImage = 'url("images\/cube.gif")';

gil davis
01-02-2003, 08:30 AM
Microsoft's MSDN Library has lots of good information, many examples, and is fairly easy to navigate. For example:

http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/background_0.asp

contains all the different attributes for backgrounds.