Test your technical skills online, appear in Virtual Interview and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Make friends on DotNetFunda.com and expand your network!
Winners

Win Prizes

Announcements
Like us on Facebook
Sponsor
Top Codes Author
Fri, 18-Apr-2014 Authors
All Time Authors
Satyapriyanayak
11600
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 : 2294 | 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.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.