在javascript中打开新标签页,使当前页面可见,但新标签页不可见 [英] Opening new tab in javascript making the current page visible but not the new tab

查看:82
本文介绍了在javascript中打开新标签页,使当前页面可见,但新标签页不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

当我们为标签保留target ="_ blank"时,新窗口将在新标签页中打开,并且对我们直接可见.我的要求是打开新窗口,但应首先显示主窗口,而不是新窗口. Wat可以帮忙吗?

谢谢...

Hi all,

When we keep target="_blank" for a tag the new window will open in new tab and it is directly visible to us. My requirement is to open new window but the main window should be first visible, not the new window. Wat to do can anybody help??

Thanks...

推荐答案

您好,Venkat,

使用javascript做到这一点:

Hi Venkat,

Do it like this using javascript:

<html>
<head>
<script type="text/javascript" language="javascript">

function OpenURL(url)
{
var newwindow=window.open(url);
window.focus();
}

</script>
</head>
<body>

<a href="javascript:OpenURL('http://www.google.com');"> Go Google </a>

</body>
</html>



如果可以帮助您,请接受此答案.祝你好运!

快乐编码:)



Accept this as answer if it helps you. Good Luck!

Happy Coding :)


这篇关于在javascript中打开新标签页,使当前页面可见,但新标签页不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆