标签:
<body> <input type="text" id="abc" /> <input type="button" value="阶乘求和结果" onclick="a()" /> </body> </html> <script> function a() { var n=document.getElementById("abc"); var n1=n.value; var c=isNaN(n1); if(c==false) { var sum=0; for (var i = 1; i <= n1; i++) { var sum1 = 1; for (var j = 1; j <= i; j++) { sum1 *= j; } sum += sum1; } document.writeln(sum); } else { alert("你的输入有误!");} } function b() { var sum = 0; for (var i = 1; i <= 100; i++) { if(i % 7 == 0 || i % 10 == 7||i/10>=7&&i/10<8) { document.writeln(i); sum+=i; } } document.writeln(sum); } b(); </script>
标签:
原文地址:http://www.cnblogs.com/1116zsc/p/5331610.html