The image in the div #TheMovingDiv starts at a certain location, set by CSS and matched by the global variables originalx and originaly. TheMovingDiv moves using WASD keys.
TheMovingDiv can't go further left than an x of 200, or higher than a y of 250 because 2 if statements prevent it.
If TheMovingDiv reaches the boundaries, namely, an x setting of 1000, OR a y setting of 600, it triggers a command (using an if statement to check if it reaches either boundary).
(The left and top sides of the white lines, respectively, indicate an x of 1000 and a y of 600)
The event used as an example here is an alert of "You made it!" (but the source code also shows a commented-out example where a window.location.replace command executes automatically).
TheMovingDiv position is counted from its top left corner, as you will notice if you pay close attention to how it reacts as it moves around the page...