Lefthand assignment - Why doesn't this lefthand assignment work? (Posted by Rhamphoryncus)
I know I the lefthand assignment is screwed up, but I can't figure out how to fix it. Any suggestions?
function flipimage(unit, img)
{
document.layers['unit'+unit+'Div'].images['unit'+unit+'Img'].src = 'images/'+img+'.gif'
}
John Pollock posted this at 16:04 — 26th October 1999.
He has: 628 posts
Joined: Mar 1999
At first glance my best guess is to try the eval funtion on the right side, perhaps:
document.layers['unit'+unit+'Div'].images['unit'+unit+'Img'].src = eval('images/'+img+'.gif');
Let us know if it works for you.
Java Script: A Beginner's Guide
Page Resource
Rhamphoryncus posted this at 00:08 — 27th October 1999.
They have: 2 posts
Joined: Sep 1999
nope, now I'm getting
document.layers["unit" + unit + "Div"].images has no
properties.
actually, I think I changed it at somepoint and got rid of the invalid lefthand assignment error.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.