I need to open a child window inside a parent window and make the child window move down and up the screen in a repetitive manner until the button stop is pressed. When the movement stops, the window should stay at its current position.
I tried to create a function to handle moving down and another one for moving up but I can't get it to work.
var cWin;
var downInterval;
var upInterval;
function openNewWin() {
cWin = open("childWin.html", "", "width=100px, height=100px");
down();
}
function down() {
downInterval = setInterval(function () {
while (cWin.screenY < 560) {
cWin.moveBy(20, 50);
}
}, 500);
clearInterval(downInterval);
}