<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>打印1-100之间所有的质数</title>
<script type="text/javascript">
for(var i=2;i<100;i++){
var a=true;
for (var j=2;j<i;j++) {
if (i%j==0) {
a=false;
}
}
if (a) {
document.write(i+" ");
} else{
}
}
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>99乘法表</title>
<script type="text/javascript">
for (var i=1;i<10;i++) {
for (var j=1;j<=i;j++) {
document.write("<span>"+j+"*"+i+"="+i*j+"</span>");
}
document.write("<br />");
}
</script>
</head>
<style type="text/css">
span{
display: inline-block;
width: 80px;
}
body{
width:2000px;
}
</style>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>倒三角</title>
<script type="text/javascript">
for (var i=0;i<5;i++) {
for (var j=1;j<5-i;j++) {
document.write("* ");
}
document.write("*<br />");
}
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>水仙花数</title>
<script type="text/javascript">
for (var i=100;i<1000;i++) {
var b=parseInt(i/100);
var s=parseInt((i-b*100)/10);
var g=parseInt(i%10);
if(b*b*b+s*s*s+g*g*g==i){
console.log(i);
}
}
</script>
</head>
<body>
</body>
</html>