Affordable Web Hosting with Excellent Customer Support internet connection free month hosting

Javascript Open Window Script

The following script will open a new browser window from a link. It will open the window centered on the screen.


Open Page

<a ref="JavaScript:openW('','BBC',400,400,'')">Open Page</a>

Open Image

<a ref="JavaScript:openW('linus.jpg','Linus',648,488,'')">Open Image</a>


<script language="JavaScript">

function openW(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win =,myname,settings);


Place code in page header (between HEAD tags). Create links per the following syntax specifications:

<a href="JavaScript:openW('URL','TITLE',WIDTH,HEIGHT,'')">LINK</a>

URL: The target page or image, etc. you want to open.
TITLE: The title of the new page. If you have 3 links opening this way to the same new window title, every link clicked will target that window. If you name the uniquely, the links will open separate windows.
WIDTH, HEIGHT: Width and Height in pixels for the new window to be opened. This will be centered on screen.
LINK: What appears on the page as linking.