<!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 onclick="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 onclick="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 onclick="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 onclick="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 onclick="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 onclick="koujue()">乘法</button>
</body>
</html>

posted on 2019-03-13 08:18  ~王~  阅读(89)  评论(0编辑  收藏  举报