0% found this document useful (0 votes)
36 views

Department of Computer Engineering: Window - Open (URL, Name, Specs, Replace)

The document discusses window objects and child windows in JavaScript. It defines that the window object represents a browser window or frame, and that the open() method is used to open new windows or tabs. It details the parameters of open() including the URL, name, specs, and replace options. Examples are given to open a new window to a URL, and to demonstrate the opener property to reference the parent window and write to both the child and parent windows.

Uploaded by

Shekhar Jadhav
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Department of Computer Engineering: Window - Open (URL, Name, Specs, Replace)

The document discusses window objects and child windows in JavaScript. It defines that the window object represents a browser window or frame, and that the open() method is used to open new windows or tabs. It details the parameters of open() including the URL, name, specs, and replace options. Examples are given to open a new window to a URL, and to demonstrate the opener property to reference the parent window and write to both the child and parent windows.

Uploaded by

Shekhar Jadhav
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

DEPARTMENT OF

COMPUTER ENGINEERING

Subject: Cilent Side Scripting Subject Code: 22519


th
Semester: 5 Course: Computer Engineering
Laboratory No: L001B Name of Subject Teacher: Khrisagar.S.B
Name of Student: Shekhar Dattatray Jadhav Roll Id:29

Experiment No: 11
Title of Experiment Develop a webpage for placing the Window on the screen and working
with child window.

Theory:

The window object represents an open window in a browser.

If a document contain frames (<iframe> tags), the browser creates one window object for the
HTML document, and one additional window object for each frame.

The open() method opens a new browser window, or a new tab, depending on your browser
settings and the parameter values.

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

URL Optional. Specifies the URL of the page to open. If no URL is specified,

a new window/tab 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, or tab. 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 window

specs Optional. A comma-separated list of items, no whitespaces.

Page | 1
replace Optional. Specifies whether the URL creates a new entry or replaces

the current entry in the history list.

The following values are supported:

 true - URL replaces the current document in the history list


 false - URL creates a new entry in the history list

Return Value: A reference to the newly created window, or

null if the call failed

Example

<html>
<body>
<p>Click the button to open a new browser window.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
window.open("https://www.microsoft.com/en-in/");
}
</script>
</body>
</html>
Output:

Page | 2
Child window

 The opener property returns a reference to the window that created the
window.
 When opening a window with the window.open() method, you can use this
property from the destination window to return details of the source (parent)
window.
 window.opener.close() will close the source (parent) window.

Example
<html>
<body>
<p>Click the button to write some text in the new window and the source
(parent) window.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var myWindow = window.open("", "myWindow", "width=200,height=100");
myWindow.document.write("<p>Hello 'SHEKHAR'</p>");
myWindow.document.write("<p>This is 'myWindow'</p>");
myWindow.opener.document.write("<p>This is the source window!</p>");
}
</script>
</body>
</html>
Output

After clicking “Try it” Button

Grade and P1 (35M) P2 (15 M) Total ( 50 M) Dated Sign


Dated
Signature of
Teacher

You might also like