最近评论
正在载入评论列表...
![]() |
![]() |
a && b 如果a和b都为true时整个表达式的值为true
a || b 只要a,b其中一个值为true时整个表达式的值为true
!a 当a为true时表达式的值为false

<html>
<head>
<title>逻辑运算符</title>
</head>
<body>
<script language="javascript">
<!--
a = true;
b = false;
c = false;
document.write('a = ',a,',b = ',b,',c = ',c,'<br>');
document.write('a && b = ',a&&b,'<br>');
document.write('a || b = ',a||b,'<br>');
document.write('!c = ',!c,'<br>');
//-->
</script>
</body>
</html>

图1.7