How to use DOM Object Open in JavaScript

In this article I am going to explain about DOM object open() method in JavaScript.
  • 1991

JavaScript DOM Object Open() Method

JavaScript open() method use for open an new page and collect output from document.write() method or document.writeln() method and result will be display on new page.

Syntax

document.close()

Example

<html>

<head>

    <script type="text/javascript">

        function myfun() {

            var mm = document.getElementsByName("Add");

            alert(mm.length);

        }

    </script>

</head>

<body>

    <h4 name="Add">

        Shayam</h4>

    <h4 name="Add">

        Ajay</h4>

    <h4 name="Add">

        Abhishek</h4>

    <button onclick="myfun()">

        click me</button>

</body>

</html>

 

Output

  

 Before Click


open1.gif


 After Click


close2.gif

 

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
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.