<html>
 <head><title>Loading JS</title>
 </head>
 <body>
  <form>
   <input type="text" id="cnt" />
  </form>
<?php
for ($i=0$i<10$i++){
    echo 
'<script type="text/javascript">document.getElementById("cnt").value = '$i';</script>';
    echo 
"\n";
    
flush();
    
sleep(1);
}
?>
 </body>
</html>