课上练习 script

mac2022-07-05  34

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

<body>判断是否是闰年<br />请输入年份:<input type="number" id="text" /><input type="button" value="检查是否是闰年" οnclick="check()" /><br /><br /><br /><br /><br />判断是否成年<br />请输入年龄:<input type="number" id="age" /><input type="button" value="判断是否成年" οnclick="check()" /><br /><br /><br />你能跑过豹子么?<input type="text" id="jieguo" /><input type="button" value="你能跑过豹子么" οnclick="nengfou()" /><br />xyz三个整数,从小到大输出<br />请输入x:<input type="number" id="x1"/>请输入y:<input type="number" id="y1" />请输入z:<input type="number" id="z1" /><input type="button" value="从小到大输出xyz" οnclick="bijiao1()" />

<br />

xyz三个整数,从小到大输出<br />请输入x:<input type="number" id="x"/>请输入y:<input type="number" id="y" />请输入z:<input type="number" id="z" /><input type="button" value="从小到大输出xyz" οnclick="bijiao2()" /><script>function bijiao2(){ var x=document.getElementById("x").value var y=document.getElementById("y").value var z=document.getElementById("z").value if(x!=""&&y!=""&&z!="") { if(x%1==0&&y%1==0&&z%1==0) { var a if(x>y) { a=y y=x x=a } if(x>z) { a=z z=x x=a } if(y>z) { a=z z=y y=a } {alert(x+" "+y+" "+z)} } else { alert("请输入整数") } } else { alert("请输入内容") } }</script>

<br />姓名:<input type="text" id="xingming" /><br />成绩:<input type="number" id="chengji"/><input type="button" value="jieguo" οnclick="chaxun()"/><br /><script>function chaxun(){ var chengji=document.getElementById("chengji").value var xingming=document.getElementById("xingming").value if(xingming!=""&&chengji!="") { if(chengji>=0&&chengji<=100) { if(chengji==100) { alert("恭喜你"+xingming+","+"满分通过") } else if(chengji>=80&&chengji<100) { alert(xingming+","+"你很优秀") } else if(chengji>=60&&chengji<80) { alert(xingming+","+"你的成绩是良好") } else if(chengji>=50&&chengji<60) { alert(xingming+","+"再接再厉") } else { alert(xingming+","+"你是笨蛋么") } } else { alert("输入有误") } } else { alert("请输入内容") } }</script></body></html><script>function check(){ var year=document.getElementById("text").value; if(year!="") { if(year>0&&year<10000) { if(year%1==0) { if(year%4==0&&year0!==0 || year@0==0) { alert("闰年") } else { alert("平年") } } else { alert("请输入整数") } } else { alert("您输入值不在年份范围内") } } else { alert("此处不能空白") } }function check(){ var age=document.getElementById("age").value if(age!="") { if(age>0&&age<150) { if(age%1==0) { if(age<18) { alert("未成年") } else { alert("成年") } } else { alert("整数") } } else { alert("超出范围") } } else { alert("不能空白") } }

function nengfou(){ var jieguo=document.getElementById("jieguo").value if(jieguo!="") { if(jieguo=="能") { alert("你比禽兽还禽兽") } else if(jieguo=="不能") { alert("你禽兽不如") } else { alert("输入有误") } } else { alert("请输入有效内容") } }function bijiao1(){ var x1=document.getElementById("x1").value var y1=document.getElementById("y1").value var z1=document.getElementById("z1").value if(x1!=""&&y1!=""&&z1!="") { if(x1%1==0&&y1%1==0&&z1%1==0) { if(x1>y1&&x1>z1) { if(y1>z1) { alert(z1+" "+y1+" "+x1) } else { alert(y1+" "+z1+" "+x1) } } else if(y1>x1&&y1>z1) { if(x1>z1) { alert(z1+" "+x1+" "+y1) } else { alert(x1+" "+z1+" "+y1) } } else if(z1>x1&&z1>y1) { if(x1>y1) { alert(y1+" "+x1+" "+z1) } else { alert(x1+" "+y1+" "+z1) } } } else { alert("请输入整数") } } else { alert("请输入数字") } }</script>

转载于:https://www.cnblogs.com/20gg-com/p/5803627.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)