How to use window object name in JavaScript

In this article i am going to explain about name property in JavaScript.
  • 2048

Name property in JavaScript window object

The name property is used to return or set a window's name.


Syntax of name property

window.name


Browser support

The name  property is supported in all major browser.

Example of name   property

<!DOCTYPE html>

<html>

<head>

<title>Name property</title>

</head>

<body>

<h1 style="color:blue">JavaScript window Object of name Property</h1>

<script type="text/javascript">

    function newwindow() {

        win1 = window.open(' ', 'NameWindow', 'width=250,height=180')

        win1.document.write("The name of the window is : " + win1.name);

    }

</script>

<form name="form1" action="#">

<br />

<input type="button" name="bt1" value="Open New window." onclick='newwindow()' />

<br />

</form>

</body>

</html>


Output:

name.jpg

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.