Blogger Information
Blog 3
fans 0
comment 0
visits 1627
Related recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0325作业
Z-X-P的博客
Original
529 people have browsed it

总结:

逻辑运算  逻辑与 && a&&b(a,b各为一个条件) a,b都为真则为真,a,b其中一个假都为假

逻辑或 || a||b(a,b各为一个条件)a,b两个都为假则为假,其余都为真

逻辑非 ! 取反即可

作业:输出学生成绩为优秀还是良好

实例

<script type="text/javascript">
		var grade = 80;
		if(grade>=60 && grade<=69){
			alert('该学生成绩及格了');
		}else if(grade>=70 && grade<=79){
			alert('该学生成绩为良');
		}else if(grade>=80 && grade<=89){
			alert('该学生成绩为良好');
		}else if(grade>=90 && grade<=100){
			alert('该学生成绩为优秀');
		}else if(grade>=0 && grade<=59){
			alert('该学生成绩为不及格');
		}else{
			alert('请输入正确的分数');
		}
	</script>

运行实例 »

点击 "运行实例" 按钮查看在线实例

作业:判断闰年

实例

<script type="text/javascript">
		//闰年判断条件:1能整除4且不能整除100 2.能整除400
		var year = 1996;
		if(year%4==0 && year/100!=0  || year % 400==0)
		{
			alert('该年为闰年');
		}else{
			alert('该年不是闰年');
		}
	</script>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post