Blog

Newest Post
Blog Archives
Blog Categories

Portfolio

3D Models
Banners
Brochures
Business Cards
Custom Programming
Environments
Flash Projects
Game Design
Image Altering
Web Design

About

Resume
Recommendation Letters

Contact

July 18, 2008

Creating a Pop Up Window with Javascript

Filed under: JavaScript,The Coding World — admin @ 10:37 am

Here is how to create a simple pop-up window using java script.

This will create a pop-up window on page load:
Place this javascript in the <head>  section of the webpage.

View Code JAVASCRIPT
onload = function () {
  PopUpURL    = "page.php";
  PopUpLeft   =  100;
  PopUpTop    =  100;
  PopUpWidth  =  600;
  PopUpHeight =  300;
   popO='left='+PopUpLeft+',top='+PopUpTop+',width='+PopUpWidth+',height='+PopUpHeight
  window.open(PopUpURL,'nrc',popO);
}

Here is how to create a Pop Up Window from a link:
Place the following code in the <head> section

View Code JAVASCRIPT
var newwindow;
function popup(url)
{
newwindow=window.open(url,'name','height=500,width=333');
if (window.focus) {newwindow.focus()}
}

This part goes in the link tag:

 <a href="javascript:popup('poppedexample.html');">Pop it</a>

Leave a Reply

© - Digital Epiphany Designs, Online Portfolio for Web Design, Custom Programming, Grapic Design and Game Design.