window.open()使用用户输入作为url源在Chrome中打开一个选项卡而不是窗口



不管我怎么尝试,这段代码仍然在一个新的选项卡中打开。关于如何修改它以打开一个新窗口,有什么想法吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Cast Challonge</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

<script type="text/javascript">

$(document).ready(function(){

$('#button').click(function(e) {  
var inputvalue = $("#input").val();
window.open("http://challonge.com/"+inputvalue+"/module?theme=5928&show_final_results=0&multiplier=0.3&show_tournament_name=1&scale_to_fit=1"),"_blank","width=1323,height=816";

});
});
</script> 
</head>
<body>

<input type="text" value="" id="input"> 
<button type="button" id="button">Submit Tournament ID</button>
</body>
</html>

如果有人需要,分享正确答案:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Cast Challonge</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

<script type="text/javascript">

$(document).ready(function(){

$('#button').click(function(e) {  
var inputvalue = $("#input").val();
window.open(("http://challonge.com/"+inputvalue+"/module?theme=5928&show_final_results=0&multiplier=0.3&show_tournament_name=1&scale_to_fit=1"),"_blank","width=1323,height=816";)

});
});
</script> 
</head>
<body>

<input type="text" value="" id="input"> 
<button type="button" id="button">Submit Tournament ID</button>
</body>
</html>

用您的新窗口名称更改'_blank'。示例:"新窗口测试">

相关内容

  • 没有找到相关文章

最新更新