JS code not working using registerJs

Hi guys,following code will only doing its job defining JS code as usual. Defining it using yii2-method registerJs won’t run JS code. Why ??This will run


<script>    function move() {        var elem = document.getElementById("myBar");        var width = 1;        var id = setInterval(frame, 50);        function frame() {            if (width >= 100) {                clearInterval(id);            } else {                width++;                elem.style.width = width + '%';                elem.innerHTML = width * 1 + '%';            }        }    }</script>


<div class="w3-container">    <h2>Connecting IMAP Server...</h2>    <div class="w3-light-grey">        <div id="myBar" class="w3-container w3-green w3-center" style="width:1%">1%</div>    </div>    

    <button class="w3-button w3-green" onclick="move()">Start ProgressBar</button></div>


  'btn btn-success', 'title' => 'IMAP Server kontaktieren', 'onclick' => 'js:move()']) ?>

This will not run


$progressBar = "function move() {        var elem = document.getElementById('myBar');        var width = 1;        var id = setInterval(frame, 50);        function frame() {            if (width >= 100) {                clearInterval(id);            } else {                width++;                elem.style.width = width + '%';                elem.innerHTML = width * 1 + '%';            }        }    }";$this->registerJs($progressBar);

Because this code creates an error

Häh? Error ??

There is no error!

Neither in Firedebug nor in php!

What kind of error are U expecting?