这段代码错误在哪里?
无论最后是点击“是”还是“取消”,结果都是执行“else”里的内容
<!DOCTYPE html>
<html>
<head>
<title>练习</title>
<meta charset="utf-8">
</head>
<script type="text/javascript">
function openwindow()
{
var a=confirm("是否打开网址");
if (a==true)
{var q=prompt("确定打开的网址","https://www.zhihu.com/");
if (q==true)
{window.open("https://www.zhihu.com/","_blank","width=400px,height=500px,top=100px,left=100px");}
else
{alert("你选择了取消!");}
}
}
</script>
<body>
<input type="button" name="button" value="点击选择是否打开" onclick="openwindow()"/>
</body>
</html>