A nubie question

What am I doing wrong?

var backgrounds = new Array("images/tiles/pattern_044.gif","images/tiles/pattern_045.gif","images/tiles/pattern_046.gif");

// setEvents is triggered by onload in the body tag
function setEvents() {   

function changeBkg() {
  if (document.body) {
    alert(backgrounds[0]);  //this gives me [B]images/tiles/pattern_044.gif[/B] as expected
//  document.body.style.backgroundImage="\\"url("+'+backgrounds[0]+'+")\\"";     // [B]this didn't work[/B]
//	document.body.style.backgroundImage="url('backgrounds[0]')";               // [B]this didn't work[/B]
 	document.body.style.backgroundImage="url('images/tiles/pattern_044.gif')"; // [B]this works but I want to use the array[/B]

all I want to do is set backgroungImage using an item from the array

Use the first commented-out line, but get rid of the single quotes around backgrounds[0]. By putting the quotes around it, JavaScript will treat it as if you really want the name of the file to be used for the background to be ‘backgrounds[0]’. Instead, put the opening single quote right after the opening parenthesis, and the closing single quote right before the closing parenthesis (within the double quotes). Also, I don’t think you need the extra pair of escaped double quotes in that string.

you’re a genius!!! this worked “url(”+backgrounds[0]+“)”
and I was sure I already tried it that way.