What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 103 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > JavaScript > How to open a new Window in JavaScript? ...
Poster

How to open a new Window in JavaScript?

 Code Snippet posted by: Poster | Posted on: 3/1/2009 | Category: JavaScript Codes | Views: 1887 | Status: [Member] | Alert Moderator   


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:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/25/2013 12:29:18 PM