<html><head>
<title>1</title>
<script type="text/javascript"><!--
var mikes_driven;
var gullons_used;var md;
var gull;
var sum;
mikes_drive=window.prompt("Miles driven");
gullons_used=window.prompt("Gullons used");if(Gullons_used==-1){break}md=parseInt(mikes_drive);gull=parsenInt(gullons_used);
sum=md/gull;document.writeln("Mikes drive:" + mikes_driven);
document.writeln("Gullons_used:" + gullons_used);
document.writeln("MPG this tankful:" + sum);
//--></script>
</head><body></body></html>

解决方案 »

  1.   


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script type="text/javascript">var mikes_driven;
    var gullons_used;var md;
    var gull;
    var sum;
    mikes_drive=window.prompt("Miles driven");
    gullons_used=window.prompt("Gullons used");
    //if(Gullons_used==-1){break}md=mikes_drive;gull=gullons_used;sum=parseInt(md)/parseInt(gull);document.writeln("Mikes drive:" + mikes_drive+"<br/>");
    document.writeln("Gullons_used:" + gullons_used+"<br/>");
    document.writeln("MPG this tankful:" + sum+"<br/>");</script>
    </head>
    <body> 
    </body>
    </html>
      

  2.   

    <html><head>
    <title>1</title>
    <script type="text/javascript"><!--
    var mikes_driven;
    var gullons_used;var md;
    var gull;
    var sum;
    mikes_drive=window.prompt("Miles driven");
    gullons_used=window.prompt("Gullons used");if(Gullons_used==-1){break}md=parseInt(mikes_drive);gull=parseInt(gullons_used); //这里代码写错了
    sum=md/gull;document.writeln("Mikes drive:" + mikes_driven);
    document.writeln("Gullons_used:" + gullons_used);
    document.writeln("MPG this tankful:" + sum);
    //--></script>
    </head><body></body></html>
      

  3.   

    if(Gullons_used==-1){break}
    应该是if(gullons_used==-1){break}