Neden bu javascript çalışmaz?

0 Cevap php

Gerçekten ben bu kodu var bana sinir bozucu oldu:

<script type ="text/javascript">
scriptAr = new Array(); // initializing the javascript array

<?php

foreach ($docsannlist as $subdocs) 
{
    $lines = $subdocs; // read file values as array in php
    $count = count($subdocs); //this gives the count of array
    //In the below lines we get the values of the php array one by one and update it in the script array.
    foreach ($lines as $line)
    {
        print "scriptAr.push(\"$line\");\n"; // This line updates the script array with new entry
    }
}

?>

document.write(scriptAr);
</script>

ve nedense sadece onun değil çalışma. Lütfen yardım edin!

0 Cevap