javascript练习题目_1、用for循环计算1加到100 的和

来源:互联网 发布:linux解包和解压 编辑:程序博客网 时间:2024/05/10 00:23
<!doctype html><html lang="en"><head><meta charset="UTF-8"><title>1、计算1加到100 的和</title><script type="text/javascript">function fun1(){var num1=0;for(var j=0;j<=100;j++){num1+=j;}alert(num1);}</script></head><body><center style="margin-top:50px;">1、计算1加到100 的和<br/><input type="button" value="计算" onclick="fun1()"/></li></center></body></html>

0 0
原创粉丝点击