Javascript Menubar problem

wxdqz

New Member
I wrote this code to display a list of menu items when the user mouseover's a perticular image. It works ok, but when I add the following line it only goes through and does the first image from the first aray. I can not figure out why.

Code:

//Array info is above//

dropimages=new Array(drop1,drop2,drop3,drop4,drop5,drop6,drop7);
names=new Array('theatre','cable','vacuum','dss','alarm','intercom','phone');
brwdth=window.document.body.clientWidth;
cntwdth=brwdth/2;
startX=275;
startY=cntwdth-205;
for (i=0;i<dropimages.length;i++) {
currntArry = dropimages;
TotSize = ((currntArry.length/2)*20);
startX=(260+(i*20));
totalcont = window.document.createElement('div');
window.document.body.appendChild(totalcont);
totalcont.style.top=startX;
totalcont.style.position='absolute';
totalcont.style.left=startY;
totalcont.style.width=170;
totalcont.style.height=TotSize;
totalcont.style.backgroundColor='red';
totalcont.id=names+'a1';
totalcont.style.visibility='visible';
newX=0;

for (k=0;k<currntArry.length;k++) {

cont=window.document.createElement('div');
totalcont.appendChild(cont);
cont.style.top=newX
newX=newX+19;
cont.style.position='absolute';
cont.id=names + 'dropcont';
cont.style.left=1;
cont.style.width=160;
cont.style.height=18;
cont.style.backgroundColor='black';
cont.style.visibility='inherit';
temp=window.document.createElement('img');
temp.style.position='absolute';
cont.appendChild(temp);
temp.src=currntArry[k];
temp.lnk="test";
temp.cont=cont;
temp.style.top=1;
temp.style.left=0;
temp.style.height=16;
temp.style.width=160;
temp.id='dropitem'+k;
temp.cont=cont;
temp.style.visibility='inherit';
temp.style.cursor='hand';

// if I insert "temp.onmouseover=alert("test");" it give me one alert when loading the page and then nothing //
k++;
}
}

so like stated right about here, when i insert anything to run on the onmouseover property of temp it runs once when loading the page, and then not at all, plus the loop is exited and none of the other arrayed items are created. This one has me way confused... any help would be appreciated.

Daniel
 
Back
Top