Create a Pop-Up Window For Your Website

A pop-up is a window that opens automatically from another window. It is usually smaller and is intended to catch the viewers attention with a special message.

The pop-up can contain any code that you would place in another HTML document. If it is used to get the visitor to give you her contact information, you could just put a form on the pop-up so that she could input her data. To increase the likelihood that the visitor gives you her contact date, you could offer something if she does, such as a free e-book, special report, a simple computer program or an entry into a contest or drawing for a free prize.

The pop-up doesn’t have to be automatic, it could be triggered by clicking on a button or image, but usually, it is coded to pop-up as soon as the homepage loads.

Here's the HTML code to open a page in a new window.

<a target="_blank" href="popupjaw.html">Create a New Window displaying another page<span style="text-decoration: none">.</span></a>

Here's the link:

Create a New Window displaying another page. The target="_blank" is the part that makes it open in an new window. If the new page is in the same directory as the current page, you just give its name in the href="popupjaw.html" part.

This link triggers the same code that displays the popup when the page loads.
Open Popup Window Use javascript for more control over the pop-up.
You can have more control over size, location, whether the window is sizeable, has a menu or status bar, etc by using javascript to create it.

The javascript code will be in two parts, one is placed in the head section of the page, the other in the body section.

Head section code:
<script>
<!--start hiding script
function PopWin(url) {
newwindow=window.open(url, 'name', 'height=150,width=150'
+ ',toolbar=no,status=no,menubar=no,directories=no'
+ ',location=no,resizable=yes,scrollbars=auto'
+ ',top=225,left=325'
);
if (window.focus) {
newwindow.focus()
}
}
//end hiding script -->
</script>

Explanation of code:
<!--start hiding script… //end hiding script-->
hides the javascript from those browsers that do not support javascript.

The other code creates a javascript function (in this case, a command that you define by writing it) named PopWin.
The PopWin function part (url) is where you replace url with the actual name of the file you want to display. Other pieces of the code tell the browser the size of the window, the location given in the number of pixels from the top and from the left side of the screen, whether to create scrollbars, or make the window resizeable, etc.

Body section code to provide a link that opens the pop-up.
<a href="javascript:PopWin('popup.html')">Open Pop-up Window</a>

This code calls the javascript function, telling it to display pop-up.html when the target text (Open Pop-up Window) is clicked on.

Code to trigger the pop-up when the main page loads:
Find the start body tag <body>
Add code inside the tag so it looks like this:
<body onload="javascript:PopWin('popup.html')">

For more explanations of the pop-up coding go to:
http://www.dollarware.us/html-starter-pages/

Get more Website tips: send a blank e-mail to:
tips-subscribe@dollarware.us