<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″ />
<title></title>
</head>
<body>
<!–<script>
function ji(){
var sum=0;
for(var i=1;i<100;i=i+2){
sum=sum+i;
}
document.write(“100以内奇数求和为”+sum);
}
</script>
<button οnclick=”ji()”>100以内奇数求和为</button>–>
<script>
function ou(){
var sum=0;
for(var i=1;i<=100;i=i+1){
if(i%2==0){
sum=sum+i;
}
}
document.write(“100以内的偶数求和为”+sum);
}
</script>
<button οnclick=”ou()”>100以内偶数求和为</button>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset=”UTF-8″>
<title></title>
</head>
<body>
<script>
function caishu(){
var a=parseInt(Math.random()*100);
var cishu=0;
for(;;){
cishu=cishu+1;
var b=prompt(“请输入你猜的数字1-100”);
if(b<a){
alert(“你输入的小了”);
}else if(b>a){
alert(“你输入的大了”);
}else{
alert(“恭喜你才对了”);
break;
}
if(cishu==10){
document.write(“不好意思你输得次数多了”)
break;
}
}
document.write(“你共输入”+cishu+”次数”)
}
</script>
<button οnclick=”caishu()”>次数</button>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset=”UTF-8″>
<title></title>
</head>
<body>
<script>
function xinhang(){
for(;;){
var a=prompt(“—1查询—2取款—3转账—-0退出–“);
if(a==1){
alert(“查询”);
}else if(a==2){
alert(“取款”);
}else if(a==3){
alert(“转账”);
}else if(a==0){
alert(“退出”);
break;
}else{
alert(“你输入错误请从新输入”);
}
}
}
</script>
<button οnclick=”xinhang()”>客服</button>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset=”UTF-8″>
<title></title>
</head>
<body>
<script>
function shui(){
var shui=parseInt(prompt(“个人月收入”));
if(shui<=3500){
alert(“你好你免税”);
}else if(shui<=5000){
shui=(shui-3500)*0.03;
alert(“你好你交税”+shui);
}else if( shui<=9000){
shui=(5000-3500)*0.03+(shui-5000)*0.1;
alert(“你好你交税”+shui);
}else if( shui>9000){
shui=(5000-3500)*0.03+(9000-5000)*0.1+(shui-9000)*0.2;
alert(“你好你交税”+shui);
}
}
</script>
<button οnclick=”shui()”>税收查询</button>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset=”UTF-8″>
<title></title>
</head>
<body>
<script>
function koujue(){
var a=prompt(“请输入数字”);
var num=0;
for(var b=1;b<=a;b++){
num=b*a
document.write(b+”*”+a+”=”+num);
document.write(‘<br/>’);
}
}
</script>
<button οnclick=”koujue()”>乘法</button>
</body>
</html>
转载于:https://www.cnblogs.com/hfew/p/10520750.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/101054.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...