You have probably come across a webpage where a small window appears at the side of the webpage and drifts to the center of the webpage. They are commonly used to present you with a form where you can enter your email address to subscribe to a newsletter. In this article I give you the code to create this type of moving popup window.
Welcome to Bucaro TecHelp!

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

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Easy Moving Popup Code

You have probably come across a webpage where a small window appears at the side of the webpage and drifts to the center of the webpage. They are commonly used to present you with a form where you can enter your email address to subscribe to a newsletter. In this article I give you the code to create this type of moving popup window.

Most of the time cut-and-paste code either doesn't work, or it works but because you don't understand it you can't modify it for your own use. If you're a frequent visitor to this website you know that I am NOT going to just give you the code. I'm going to give you a tutorial explaining how the code works so that you completely understand it and can modify it for your own use.

If you're NOT an experienced Java Script programmer, here's how you should proceed: Create a new folder to contain your project files. As you're reading this article, type the code into Windows Notepad. Save each example file with the extension .htm. To demonstrate the example, double-click on the file name and it will open in Internet Explorer.

Basic Code

In each example, start by typing in the tags shown below, which creates the basic structure of a webpage.

<html>
<head>
<script language="JavaScript">
</script>
</head>
<body>
Any text you type between the body tags will appear on your webpage. Just type in some random text.
</body>
</html>

Every example will begin with the code shown above. Between the script tags you will be adding some very simple Java Script code. Most of your code will contained within small Java Script functions, which have the structure shown below.

function functionName()
{
  code goes here;
}

Every example will use the five functions listed below.

createPopUp
moveIn
beginDelay
endDelay
moveOut

The createPopUp function will create the popup and call the moveIn function.

The moveIn function will move the popup to the center of the webpage and then call the beginDelay function.

The beginDelay function will use the Java Script built-in setTimeout function to create a delay before it calls the endDelay function.

The endDelay function will use the clearTimeout function to end the delay and then call the moveOut function.

The moveOut function will move the popup out of the window and then close it.

Web Design Sections

RSS Feed RSS Feed

Easy Java Script Code
Easy Java Script Windows
Easy Rollovers
Easy Picture Transition Effects
Easy Moving Popup Code
Easy Slide Show Code
Easy Slide Show Code With Linked Slides
Slide Show with Different Size Images
Easy Picture Zoom Code
Easy Picture Panning Code
Easy Java Script Animation
Easy JavaScript Picture Selector Code
Easy Animated Banners with Java Script
Easy Java Script Form Validation
Easy Drag n Drop Code
Easy Graph Generating Code
Easy Code to Sort a Table by Column
Easy Fading Text Banner Code
Easy Expanding Banner Code
Calendars for Your Website
Date Picker For Your Web Site
Calculators For Your Web Site
Loan Payment Calculator
Length Units Converter
Body Mass Index
Fahrenheit to Celsius Converter
Decimal to Hexidecimal Converter
Easy Code for Screen Tape Adding Machine
Code for Java Script Circle⁄Sphere Calculator
Round a Float to 4 Digits to the Right of the Decimal Point
Make Your Own Graphical Digital Clock
Let Your Web site Visitors Set Font Size
How to Disable the Browser Back Button
Add More Bang to Your Content With Keyword Popup Menus
Put a Music Off Switch on Your Webpage
Java Script Random Password Generator
Password Protection Using Java Script
Replace Drop-down with Drag-and-drop
Submit Forms Without CGI
Code for a Less annoying Popup Window
Using the Java Script Array Object
Using the Java Script Date Object
Java Script Message Boxes
How to Shuffle the Deck With Java Script
Web Site Menus : Which Section Am I In?
How Far Did the User Scroll?
Where Did the User Click?
Four Ways to Use Java Script Event Handlers
Create Your Own Database Using Only Notepad : CDV

[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2007 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269