如何将变量值放在进度栏中?

时间:2019-06-18 18:43:32

标签: javascript html

I want the result of pillar score in the progressbar 我如何在我的progresbar中获得postsScore的结果?

我的脚本中有此代码,HTML中有此代码

<input id="PillarScore"
       name="pillarScore"
       novalidate 
       type="number"
       class="form-control compute"
       readonly="readonly"
       onkeyup="PillarScoreCalcul()"
       onchange="PillarScoreCalcul()"
       oninput="validity.valid||(value='')" ; />
<br />
<div class="progress">
    <div class="progress-bar progress-bar-primary"
         role="progressbar"
         aria-valuenow="0"
         aria-valuemin="0"
         aria-valuemax="100"
         style="width: 50%;"></div>
</div>

$(document).ready(function()
{
    $('input.compute').keyup(function(ev)
    {
        PillarScoreCalcul();
        $('#PillarScore').html((pillarScore).toFixed(0));

        return pillarScore;
    });

    $('.progressbar').each(function()
    {
        var pillarScore = $(this);

        pillarScore.progressbar({
            value: pillarScore.data("progress-value")
        });
    });
});

function PillarScoreCalcul(){         var ExcellenceInExecution = parseInt(document.getElementById('ExcellenceInExecution')。value);         var goingTheExtraMile = parseInt(document.getElementById('GoingTheExtraMile')。value);         var pragmaticNimbleFlexible = parseInt(document.getElementById('PragmaticNimbleFlexible')。value);

    pillarScore = Math.round(((excellenceInExecution + goingTheExtraMile + pragmaticNimbleFlexible) / 30) * 2000);
    document.getElementById('PillarScore').value = pillarScore;

    if(isNaN(pillarScore)){
         pillarScore = document.getElementById(' PillarScore').innerHTML = 'Calculating...'; 
    }
}

0 个答案:

没有答案