1、1,如图所示

2、2,或者直接复制以下代码到记事本,然后将扩展名改为html,用浏览器运行即可。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1--100奇数和</title>
<script>
var n=1;
var m=0;
while(n<=100){
m=m+n;
n=n+2;
}document.write(m)
</script>
</head>
<body>
</body>
</html>



