if(open1==ture)和if(open1="ture")和if(open1)在下面代码中的表现?
可以发现
if(open1==ture)和if(open1)效果是等同的,而if(open1="ture")貌似是错误的表达。有大神帮忙解释下吗?
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function openWindow()
{
var open1 = confirm('really open?');
if (open1 ==true)
{
var open2 = prompt('open what?','http://www.imooc.com');
window.open(open2,'_blank','width=400,height=500,toolbar=no,menubar=no')
}
else
{ }
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>