alert会返回值吗
alert不会返回值true吧?所以有人用IF判断,应该是行不通的
alert不会返回值true吧?所以有人用IF判断,应该是行不通的
2016-12-30
<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<script type="text/javascript">
function a(val){
if(val==1){
var b=true;
}else{
var b=false;
}
console.log(b);
alert(b);
}
</script>
<button onClick="a(1);"> true </button>
<button onClick="a(2);"> false </button>
</body>
</html>
举报