console
document.write('<br/>3.判断是否为闰年--------------------------------<br/>');
function isRunYear(year) {
//如果是闰年返回true,不是则返回false。
var flag = false;
if(year%4==0&&year%100!=0||year%400==0)
{
flag = true;
}
return flag;
}
document.write(isRunYear(2000));
document.write(isRunYear(2001));
document.write(isRunYear(2020));
document.write('<br/>4.求出25,36,77,11四个数中的最大值--------------------------------<br/>');
function getMax(a,b,c,d){
var max;
max=(a>b)?a:b;
max=(max>c)?max:c;
max=(max>d)?max:d;
return max;
}
document.write("四个数中的最大值为"+getMax(25,36,77,11)+'<br/>');
document.write('<br/>5.求出25,36,77,11,125五个数中的最大值和最小值--------------------------------<br/>');
function Max(e,f,g,h,i){
var max;
max=(e>f)?e:f;
max=(max>g)?max:g;
max=(max>h)?max:h;
max=(max>i)?max:i;
return max;//返回最大值
}
document.write("五个数中的最大值为"+Max(25,36,77,11,125)+'<br/>');
//求出五个数中的最小值
function Min(l,m,o,p,q){
var min;
min=(l<m)?l:m;
min=(min<o)?min:o;
min=(min<p)?min:p;
min=(min<q)?min:q;
return min;
}
document.write("五个数中的最小值为"+Min(25,36,77,11,125)+'<br/>');
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div><a href="javascript:welcome">Welcome</a></div>
</body>
</html>