我想弹出第一个对话框就显示-100,第二个就显示-200,第三个就显示-300,以此类推.....只到-500就停止.
该怎么写啊?
<!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=gb2312" />

<script type="text/javascript">
for(var i=0; i<= -500; i++){
var i = i-100;
alert(i);
}
</script>
</head>
<body>
</body>
</html>

解决方案 »

  1.   


        for(var i=1; i<= 5; i++){
            var i = -100*i;
            alert(i);
        }
      

  2.   

    <!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=gb2312" />
        
    <script type="text/javascript">
        for(var i=1; i<= 5; i++){
            var a = -(i*100);
            alert(i);
        }
    </script>
    </head>
    <body>
    </body>
    </html>
      

  3.   

    <script type="text/javascript">
        for(var i=1; i<= 5; i++){
            var a = -(i*100);
            alert(a);//改下
        }
    </script>是a
      

  4.   

       for(var i=0; i<= -500; i++){
            var i = i-100;
            alert(i);
        }
      

  5.   

    for(var i=-100;i>=-500;i-=100){alert(i);}
      

  6.   

    <!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>无标题文档</title>
    <script type="text/javascript">
    var i=1;
    function init(){
    if(i==6) return; 
    alert(i*-100);
    i++;
    setTimeout('init();',500)
    }
    </script></head><body onload="init();">
    </body>
    </html>
      

  7.   

    <!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=gb2312" />
        
    <script type="text/javascript">
        for(var i=0; i>= -500; i -=100){
            alert(i);
          }
    </script>
    </head>
    <body>
    </body>
    </html>
      

  8.   

    html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    var i=1;
    function init(){
    if(i==6) return;  
    alert(i*-100);
    i++;
    setTimeout('init();',500) 
    }
    </script></head><body onload="init();">
    </body>
    </html>
      

  9.   


    for (var i = -100; i <= -500; i-=100)
    {
        alert(i);
    }