Blogger Information
Blog 3
fans 0
comment 0
visits 1961
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第五期_前端基础-JavaScript基础
Freeflight的博客
Original
742 people have browsed it

【案例1】判断是否为闰年

实例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
<!--var year=2019;
-->

<!--window.alert("欢迎进入闰年判断系统。");-->

var year=prompt("请输入年份");


if(year%4==0&&year%100!=0||year%400==0){
	
	alert("是闰年");
	
	}else{
		alert("不是闰年");
		}

</script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
</body>
</html>

运行实例 »

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


【案例2】给学生的具体成绩划分等级,优秀(90-100)、良好(80-89)、良(70-79)、及格(60-69)、不及格(0-59),输出该学生的成绩是哪个阶段


实例

<script>

var student=prompt('请输入学生成绩');
    
	if(student>=90&&student<=100){
	
	alert("该学生成绩优秀");
		}else{
			if(student>=80&&student<=89){alert("该学生成绩良好");}
			else{if(student>=70&&student<=79){alert("该学生成绩良");}
			else{if(student>=60&&student<=69){alert("该学生成绩及格");}
		    else{if(student>=0&&student<=59){alert("该学生成不绩及格");}
			}
            }
			}
			}

</script>

运行实例 »

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



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