输入按钮target =“_blank”不会导致链接加载到新窗口/选项卡中 [英] Input button target="_blank" isn't causing the link to load in a new window/tab
本文介绍了输入按钮target =“_blank”不会导致链接加载到新窗口/选项卡中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有输入按钮的HTML文件。
这只是一个示例按钮,但它包含了所有必要的代码信息:
I have an HTML file with an input button. This is only an example button, but it's including all necessary info of code:
<input type="button" onClick="parent.location='http://www.facebook.com/'" value="facebook" target="_blank">
出于某种原因,它不会在新窗口/选项卡中加载。
For some reason, it's not loading in a new window/tab.
推荐答案
您需要这样做...
<a type="button" href="http://www.facebook.com/" value="facebook" target="_blank" class="button"></a>
并添加基本的css,如果你想让它看起来像一个btn ..就像这样
and add the basic css if you want it to look like a btn.. like this
.button {
width:100px;
height:50px;
-moz-box-shadow:inset 0 1px 0 0 #fff;
-webkit-box-shadow:inset 0 1px 0 0 #fff;
box-shadow:inset 0 1px 0 0 #fff;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ffffff), color-stop(1, #d1d1d1) );
background:-moz-linear-gradient( center top, #ffffff 5%, #d1d1d1 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#d1d1d1');
background-color:#fff;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #dcdcdc;
display:inline-block;
color:#777;
font-family:Helvetica;
font-size:15px;
font-weight:700;
padding:6px 24px;
text-decoration:none;
text-shadow:1px 1px 0 #fff
}
.button:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #d1d1d1), color-stop(1, #ffffff) );
background:-moz-linear-gradient( center top, #d1d1d1 5%, #ffffff 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d1d1d1', endColorstr='#ffffff');
background-color:#d1d1d1
}
.button:active {
position:relative;
top:1px
}
目标仅适用于href标记。
target works only with href tags..
这篇关于输入按钮target =“_blank”不会导致链接加载到新窗口/选项卡中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文