Welcome to Bucaro TecHelp!

Bucaro TecHelp
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

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:
• The Screen Object
• Java Script alert Message Box
• Determine Absolute Value
• Accessing Web Page Elements
• Extract Part of a String
• Java Script Number Object
• The continue Statement
• Java Script Math.sin Method
• The if/else Structure
• Java Script Data Types

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