Loading ...

Open a New Window in JavaScript | CodeAsp.Net

Open a New Window in JavaScript

 /5
0 (0votes)

In this blog I will explain how to open a new window in JavaScript.

Example:-

<html>
<head>

<script type="text/javascript">

function openWin() 
{
	window.open("http://www.google.co.in/", "newWin", "status,width=500,height=500,top=300,left=300");
}


</script>
</head>

<body>

<form>
<input type="button" value="Open window" onclick="openWin()">
</form>


</body>
</html>


</html>

window.open() takes three parameters:-

  1. the URL of the file to be opened. If you do not give the URL of a file, you can used double quotes, "", which will open a blank window.
  2. the name of window.
  3. the attributes to be used in the new window.(we can use width, height, toolbar, location, scrollbars, status, etc attributes)

 

Mohit Kumar

Comments (no comments yet)

Top Posts