Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Javascript Javascriptexamples JavaScript Open link in new window

Related Tutorials


Share on Google+Share on Google+

JavaScript Open link in new window

This page discusses - JavaScript Open link in new window

JavaScript Open link in new window


In this section, you will learn how to open a new window on clicking the link using JavaScript. 

To open a new window with a link within the web page, we have used the JavaScript method Now in order to give specific look to the new window, we have used some attributes like scrollbars, width, height, left, top etc. When you load the following html code, you will get a link. On clicking the link, a new window will get open and allow the user to interact with it.

Here is the code:

<h2>Open link in new Window</h2>
<script language="JavaScript">
function openNewWindow() {'','new-window','directories, status, scrollbars, resizable, dependent, width=500, height=200, left=0, top=0');
<a href="javascript:openNewWindow();">Go to new window</a>

Output will be displayed as:

Download Source Code:



If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 18, 2011

Related Tutorials

Discuss: JavaScript Open link in new window  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image