Hahaha. I was still playing around with setTimeout as I was hoping to see some scroll-while-you-wait functionality. Hahaha, no matter how I tried, it appears, from my little newbish experience only, that setTimeout has got a lot of issues - sometimes it apparently hangs my Firefox 2.0.0.12 browser. All this is funny because only a simple repositioning of a single statement would make my efforts look silly.
Also, I observed that the scroll-while-you-wait functionality was not really achievable via the simplistic route:
$results = nl2br(htmlentities(shell_exec($cmd)));
echo $results;
...
el.innerHTML = el.innerHTML + '<br />' + x.responseText;
I mean, we wouldn't be able to get any dynamic output here. What was I thinking? :-P
In my scroll-while-you-wait tests, I did some pretty long shell commands:
dir c:\windows\system32 /s /a
dir c:\ /s /a
:-P
OK, back to comments for improvements. I am interested in seeing a:
document.getElementById('cmd').disabled = true;
after
var id='shell';
in function sendcmd(). Of course, this should be paired with a:
document.getElementById('cmd').disabled = false;
after
document.getElementById('cmd').value = '';
within the same function. By doing this, we are eliminating multiple pending cmd sends that would sometimes produce long results.