jazz
jazz

Reputation: 73

what is name parameter in window.open()

please can some one tell me what is this window name in window.open() is it title name or some Id in java script language?

Upvotes: 4

Views: 7412

Answers (3)

AxelEckenberger
AxelEckenberger

Reputation: 16926

From the documentation:

sName

Optional. String that specifies the name of the window. This name is used 
as the value for the TARGET  attribute on a form  or an anchor  element.

_blank
    The sURL is loaded into a new, unnamed window.
_media
    The url is loaded in the Media Bar in Microsoft Internet Explorer 6. 
    Windows XP Service Pack 2 (SP2) and later. This feature is no longer 
    supported. By default the url is loaded into a new browser window or 
    tab.
_parent
    The sURL is loaded into the current frame's parent. If the frame has 
    no parent, this value acts as the value _self.
_search
    Disabled in Windows Internet Explorer 7, see Security and Compatibility 
    in Internet Explorer 7 for details. Otherwise, the sURL is opened in the 
    browser's search pane in Internet Explorer 5 or later.
_self
    The current document is replaced with the specified sURL.
_top
    sURL replaces any framesets that may be loaded. If there are no framesets 
    defined, this value acts as the value _self.

Upvotes: 2

Pratik Deoghare
Pratik Deoghare

Reputation: 37172

windowName

A name to be given to the new window. The name can be used to refer this window again.

After opening the window you will want to do all sorts of things with it e.g. move it it then you can do

<html>
<head>
<title>Window Example</title>
</head>
<SCRIPT language="JavaScript1.2">
function poponload()
{
    testwindow= window.open ("", "mywindow");
    alert('I will move window to 0,0');
    testwindow.moveTo(0,0);
}
</SCRIPT>
<body onload="javascript: poponload()">
<H1>Window Example</H1>
</body>
</html> 

And NO its not window title its different.

-source

Upvotes: 4

Russ Cam
Russ Cam

Reputation: 125488

From MDC on window.open()

window.open(strUrl, strWindowName  [, strWindowFeatures]);

strWindowName
This is the string that just names the new window. Such string can be used to be the target of links and forms when the target attribute of an <a> element or of a <form> is specified. This string parameter should not contain any blank space. strWindowName does not specify the title of the new window.

Upvotes: 2

Related Questions