Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Codes Author
Tue, 29-Jul-2014 Authors
All Time Authors
Satyapriyanayak
12160
Jayakumars
8120
Niladri.biswas
6000

Latest members | More ...


(Statistics delayed by 5 minutes)

How to open a new Window in JavaScript?

Poster
Posted by Poster under JavaScript on 3/1/2009 7:28:15 AM | Views : 2468 | Status : [Member]

Use following function

// open new window with specified path

function OpenWindow(url)
{
newwindow = window.open(url, 'mywindow', 'width=500,height=400');
newwindow.focus();
}


where window.open parameters are like this

1st parameter: is the actual url to open like "http://www.dotentfunda.com"
2nd parameter is the name of the new window, you can refer in your code
3rd parameter is the property of the window you can specify (for all property details, see http://www.pageresource.com/jscript/jwinopen.htm)

You can use above function like this
For Link <a href="javascript:OpenWindow('http://www.dotnetfunda.com')">Open DotNetFunda.Com</a>
For Button <input type="button" value="Open New Window" onClick="OpenWindow('http://www.dotnetfunda.com')" />


Found interesting? Add this to:



Comments or Responses


Login to post response