Javascript循环没有停止。.一秒钟后,我的结果消失了

|| 我的javascript函数要求定义一些变量,这些变量将使用户遍历测验问题,增加或减少数字并达到一个总和,该总和随后将以HTML形式调用。一切正常,但是循环并没有在客户端结果上结束,而是在屏幕上闪烁并消失,就像脚本正在等待用户重新开始提问一样。我是否认为问题出在javascript循环中是正确的?谢谢:
var max_points = 28;
var total_points = 0;
var percentage_addiction = 0;

var reloadVar = \"yes\";

function makeChanges(currentQuestion, nextQuestion, points){
//display only needed question
document.getElementById(currentQuestion).style.display=\"none\";
document.getElementById(nextQuestion).style.display=\"block\";

//add total points
total_points = total_points + points;

//show image that corresponds to points
for( var i = 0; i < 15; i++)
{
    if( ( total_points > i*2 ) && ( total_points <= (i+1)*2 ) )
    {
        //hide image that was shown previously
        document.getElementById(\'img\' + i).style.display=\"none\";

        //display image that corresponds points
        document.getElementById(\"img\"+(i+1)).style.display=\"block\";
    }
}

percentage_addiction = Math.floor( (total_points/max_points)*100 );

if( nextQuestion == \"result\" )
{
    document.getElementById(\"code\").style.display=\"block\";
    //document.form1.percentage.value=escape(document.percentage); 
    location.replace(\'http://URL?percentage=\'+percentage_addiction+\'&end=yes&oneSubmit=yes\');
}

//update percentage in page
document.getElementById(\'percentage\').innerHTML = percentage_addiction;
document.getElementById(\'percentage2\').innerHTML = percentage_addiction;
}


function submitForm(){
document.form1.submit();
}
    
已邀请:
        显示结果后,重定向将自动运行:
location.replace( \'http://URL?percentage=\' + percentage_addiction + \'&end=yes&oneSubmit=yes\' );
这导致结果在一秒钟后消失。删除它或将其绑定到文档中的按钮或链接。     

要回复问题请先登录注册