<body>
<input type="button" onclick="test()" />
<script type="text/javascript">
var tmp = "";
function test(){
if(tmp == ""){
tmp = window.open("你需要打开的网址");
}else{
tmp.close();
tmp = "";
}
}
</script>
</body>
<!--这样就能按钮点一下打开,再点一下关闭-->
<!--https://zhidao.baidu.com/question/177205172713560684.html-->