Terminal control/Preserve screen: Difference between revisions

From Rosetta Code
Content added Content deleted
(Initial task)
 
(Tentative Javascript implementation (assumes browser environment))
Line 4: Line 4:


[[Terminal Control::task| ]]
[[Terminal Control::task| ]]

=={{header|Javascript}}==

<lang javascript>(function tcps() {
var orig= document.body.innerHTML
document.body.innerHTML= '';
setTimeout(function() {
document.body.innerHTML= 'something'
setTimeout(function() {
document.body.innerHTML= orig;
}, 1000);
}, 1000);
})();
</lang>

This implementation assumes that Javascript is running in the browser.

This task does not admit sample output, but you can demonstrate this solution for yourself using the chrome browser: control-shift-J then copy and paste the above into the command line, and hit enter.

Revision as of 19:31, 21 March 2011

Terminal control/Preserve screen is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to clear the screen, output something on the display, and then restore the screen to the preserved state that it was in before the task was carried out.


JavaScript

<lang javascript>(function tcps() { var orig= document.body.innerHTML document.body.innerHTML= ; setTimeout(function() { document.body.innerHTML= 'something' setTimeout(function() { document.body.innerHTML= orig; }, 1000); }, 1000); })(); </lang>

This implementation assumes that Javascript is running in the browser.

This task does not admit sample output, but you can demonstrate this solution for yourself using the chrome browser: control-shift-J then copy and paste the above into the command line, and hit enter.