javascript中打开新窗口的方法
最近做一个项目,需要在Javascript打开新窗口,使用location.href和location.replace都只能在当前页打开,使用open又容易被链接,最后想了一个变通的方法。
<script type=”text/javascript” language=”JavaScript”>
function GoUrl()
{
document.all.netbee.href=”http://www.cha138.com/;
document.all.netbee.target=”_blank”;
document.all.netbee.click();
return false;
}
</script>
然后在html文件中加一个
<a id=”netbee”></a>