02-10-2003, 01:14 PM
|
#1
|
|
Member (10 bit)
Join Date: May 1999
Location: Orlando, FL
Posts: 975
|
Javascript - menus in motion
I am trying to create a function that sends the current div off the screen (left=700 for testing) and then move the next div onto the screen (left=200). I am very close but am falling short when trying to assign a value to a function (eval). Any help would be great appreciated.
Code:
< script language='javascript' >
var curActive = 'Sec0';
var nextActive;
function setActive(SecID){
nextActive = SecID;
LoopOffScreen(curActive);
}
function LoopOffScreen(SecID){
if(parseInt(eval(SecID + '.style.left,10')) < 700){
eval(SecID + '.style.left') = parseInt(eval(SecID + '.style.left,10')) + 1;
setTimeout('LoopOffScreen(curActive);',1);
} else {
curActive = nextActive;
LoopOnScreen(curActive);
}
}
function LoopOnScreen(SecID){
if(parseInt(SecID.style.left,10) < 200){
SecID.style.left = parseInt(SecID.style.left,10) + 1;
setTimeout('LoopOnScreen(curActive);',1);
}
}
< /script >
|
|
|