Blogger Information
Blog 27
fans 1
comment 1
visits 21985
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
js第一课if判断 -php五期线上班
哥特的博客
Original
698 people have browsed it

总结:熟悉 正常的+ - * / += -= *= /=  运算符,需要注意的是数学运算符的‘=’在这里是赋值的意思,不是等于,==是等于 ===是全等于。 % 取模 运算符。

判断闰年 如果一个数字取模后的直不等于0,那么这个数字就是闰年。

判断成绩优秀,进行多条件判断最后如果都不符合就输出默认值。


实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>闰年</title>
</head>
<body>
	<script type="text/javascript">
		var num = 2006;
		// var d=num %400 
		// alert(d)
		if(num %2 !=0 || num %2 !=0){
			alert('不是闰年');
		}else if(num % 400 !=0){
			alert('不是闰年');
		}else{
			alert('闰年');
		}
	</script>
	<script type="text/javascript">
		cj = 40;
		if(cj>=90){
			document.write('优秀');
		}else if(cj >=80){
			document.write('良好');
		}else if(cj >=70){
			document.write('良');
		}else if(cj >=60){
			document.write('及格');
		}else{
			document.write('不及格');
		}




	</script>
</body>
</html>

运行实例 »

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


Correction status:qualified

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