Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript window.open()中的name参数是什么_Javascript - Fatal编程技术网

Javascript window.open()中的name参数是什么

Javascript window.open()中的name参数是什么,javascript,Javascript,有人能告诉我在window.open()中这个窗口名是什么吗?它是标题名还是java脚本语言中的某个Id?来自 window.open(strUrl, strWindowName [, strWindowFeatures]); strWindowName 这是一个字符串,用于命名 新窗口。这样的字符串可以用于 在以下情况下成为链接和表单的目标: 元素的目标属性 或指定了一个。这 字符串参数不应包含 任何空白处strWindowName 不指定新文档的标题 窗户 要为新窗口指定的名称。该名称可

有人能告诉我在
window.open()
中这个窗口名是什么吗?它是标题名还是java脚本语言中的某个Id?

来自

window.open(strUrl, strWindowName  [, strWindowFeatures]);
strWindowName
这是一个字符串,用于命名 新窗口。这样的字符串可以用于 在以下情况下成为链接和表单的目标:
元素的目标属性 或指定了一个
。这 字符串参数不应包含 任何空白处<代码>strWindowName 不指定新文档的标题 窗户

要为新窗口指定的名称。该名称可用于再次引用此窗口

打开窗户后,你会想用它做各种事情,例如,移动它,然后你就可以做了

<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> 

窗口示例
函数poponload()
{
testwindow=window.open(“,“mywindow”);
警报(“我将把窗口移到0,0”);
testwindow.moveTo(0,0);
}
窗口示例
它不是
窗口标题
它的不同

来自:

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.

我相信这些“特殊”名称不适用于open()-方法,只适用于目标属性。否则,它将意味着一个open()targeting _self将与设置location.href相同。有趣的是,在FF 3.6中似乎就是这样。您的示例移动了分配给window.open的变量“testwindow”,而不是窗口名“mywindow”。请更新您的示例。
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.