<SCRIPT language="JavaScript1.2">
function openwindow()
{
window.open("http://www.javascript-coder.com","mywindow","menubar=1,resizable=1,width=350,height=250");
}
</SCRIPT>
<P>
<A href="javascript: openwindow()">Open the JavaScript Window Example 1</A>
</P>
这是一个在新窗口中打开URL的例子。我怎样才能让它在同一个窗口中打开呢?类似于target=self
。
2条答案
按热度按时间f2uvfpb91#
简单地使用一个锚,它是什么:
不需要javascript;)
然而,当前窗口的设置(菜单条,滚动条等)不能被javascript改变.这只能在新建窗口中才能改变.
如果您确实需要使用window.location
nimxete22#
就这么办吧:
这将把当前窗口的位置赋给url,类似于self = target。