Click to See Complete Forum and Search --> : DOM


AntonioMainenti
01-18-2003, 03:47 PM
I'm trying to make a JavaScript that changes a certain <div>'s position when you click a button. I want it to know which <div>'s position to change by looking at a certain element of an array.

First, I make the array.

var the_array=new Array("a","b","c");

I want it to be able take the_array[x] and change the position of the <div> with the 'id' that is equal to whatever is in the_array[x].

I tried:

document.all.+the_array[x]+.style.top=210;
document.all.+the_array[x]+.style.left=210;

and the same thing without the plus signs, but apparently I'm not allowed to do that.

I'd really like to get this done today, so please help.

Thanks, Alan.

AntonioMainenti
01-18-2003, 04:05 PM
Wow, thanks a lot