0

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);
}
Puka
  • 1,485
  • 1
  • 14
  • 33
  • Do you have a specific error to get us started on your problem? – Puka Nov 13 '20 at 13:29
  • I'd imagine most modern browsers would block this behaviour in 2020. It's the kind of spam advertising you used to see in the 90s – Liam Nov 13 '20 at 13:41
  • Does this answer your question? [Javascript Move opener window](https://stackoverflow.com/questions/14632143/javascript-move-opener-window) – Liam Nov 13 '20 at 13:42
  • 1
    As expected [You must beware that many browsers will disallow funny behavior like...(this)](https://stackoverflow.com/a/14633059/542251) – Liam Nov 13 '20 at 13:43

0 Answers0