Wednesday, November 2, 2011

Opening a New Window With JavaScript

Use Window open() Method.
The open() method opens a new browser window.

Syntax

window.open(URL,name,specs,replace)

Parameter
URL

Optional. Specifies the URL of the page to open. If no URL is specified, a new window with about:blank is opened
name
Optional. Specifies the target attribute or the name of the window. The following values are supported:

  • _blank - URL is loaded into a new window. This is default
  • _parent - URL is loaded into the parent frame
  • _self - URL replaces the current page
  • _top - URL replaces any framesets that may be loaded
  • name - The name of the window ‘
<html>
<head>
<script type="text/javascript">
function open_win()
{
window.open(http://www.niranjankala.in”)
}
</script>
</head>
<body>
<input type=button value="Open Window" onclick="open_win()" />
</body>
</html>

No comments :

Post a Comment