Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Use moveBy Method to Move Window by a Specific Offset

In this article, I show you how to use Java Script to move a window from its current position to a new position by an offset number of pixels. To accomplish that, I will use the window object's moveBy method. Click on the link below to create a window.

Create Window

I used a variable named moveBYwin in the window.open method to create the window. We can use that variable name to control the window. Shown below is code to move the window 20 pixels to the right and 20 pixels down.

<a href="#" onclick="moveBYwin.moveBy(20,20);">Move Window</a>

Click on the link below to move the window. It will move 20 pixels to the right and 20 pixels down each time you click the link.

Move Window

When you click on the link, it gives the focus to the window with the link, so your browser window may hide the moveBYwin window. In that case, click on the link below to move it to the top where you can see its new location.

Move to Top

Eventually, you may want to close the moveBYwin window. To do that click in the link below.

Close Window

If you want to move a window to a specific loation on the screen, then you're looking for the moveTo method.

More Java Script Code:
• Java Script confirm Message Box
• Generating Random Numbers
• Java Script Arithmetic Operators
• Using the Java Script eval() Function
• Java Script Events
• The break Statement
• The Navigator Object
• Format a Number as Currency
• The Location Object
• The Conditional Operator

RSS Feed RSS Feed



Follow Stephen Bucaro Follow @Stephen Bucaro


Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2018 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268