Terminal control/Preserve screen: Difference between revisions
(description updated in response to questions raised in discussion) |
m (whitespace) |
||
Line 1: | Line 1: | ||
{{draft task}} |
{{draft task|Terminal control}}[[Terminal Control::task| ]] |
||
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. There is no requirement to change the font or kerning in this task, however character decorations and attributes are expected to be preserved. If the implementer decides to change the font or kerning during the display of the temporary screen, then these settings need to be restored prior to exit. |
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. There is no requirement to change the font or kerning in this task, however character decorations and attributes are expected to be preserved. If the implementer decides to change the font or kerning during the display of the temporary screen, then these settings need to be restored prior to exit. |
||
[[Terminal Control::task| ]] |
|||
=={{header|Javascript}}== |
=={{header|Javascript}}== |
||
<lang javascript>(function() { |
<lang javascript>(function() { |
||
var orig= document.body.innerHTML |
var orig= document.body.innerHTML |
||
Line 16: | Line 12: | ||
}, 1000); |
}, 1000); |
||
}, 1000); |
}, 1000); |
||
})(); |
})();</lang> |
||
</lang> |
|||
This implementation assumes that Javascript is running in the browser. |
This implementation assumes that Javascript is running in the browser. |
Revision as of 13:48, 24 March 2011
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. There is no requirement to change the font or kerning in this task, however character decorations and attributes are expected to be preserved. If the implementer decides to change the font or kerning during the display of the temporary screen, then these settings need to be restored prior to exit.
JavaScript
<lang javascript>(function() { 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.