John said:
Hi
I have the following in a Perl script. I just want to "clear screen" but it
does not work.
If I was a nasty guy, I would say that try to learn a language by just
inserting random made up commands (like moveTo used to move browser
window) and then see the results is a *very* long learning curb with a
high risk of no success. If I was really nasty, I would finish it by
"read the damn manual" ;-)
As I am not such guy:
JavaScript has no build-in means to accept input and show output. It
can do it only through the methods of host objects (browser DOM in most
cases). If you want to "try the water" with JavaScript, you can use a
form textarea for output for your script.
<html>
<head>
<title>Hello world</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function init() {
var out = document.forms[0].elements['output'];
for (var i=0; i<3; i++) {
out.value+= 'Hello world' + '\n';
}
// out.value = ''; // will "clear the output"
}
window.onload = init;
</script>
</head>
<body>
<form method="post" action="">
<textarea name="output" cols="70" rows="20"></textarea>
</form>
</body>
</html>