By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,442 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

how do I 'clear screen''

P: n/a
Hi

I have the following in a Perl script. I just want to "clear screen" but it
does not work.
I don't think I've got my client and server sides confused.

Any ideas?

<SCRIPT Language="JavaScript">
moveTo (0,0);
</SCRIPT>

Thank you
John
Sep 19 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
John wrote:
I have the following in a Perl script. I just want to "clear screen" but
it does not work.
JavaScript doesn't have a "clear screen" as such. What is the screen anyway?
Its not often you see JavaScript running in a console window.

In a browser you generally have an HTML document, which JavaScript can
modify. I suppose deleting all the child nodes of the body element could be
thought of as clearing the screen.

<http://w3.org/DOM/DOMTR/>
<SCRIPT Language="JavaScript">
This is HTML 3.2. The language attribute was deprecated and replaced with
the type attribute about a decade ago.
moveTo (0,0);
This, IIRC, attempts to move the browser window about on screen. Thankfully
most browsers seem to come with options to selectively disable that bit of
JS these days. Its very irritating.
--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Sep 19 '06 #2

P: n/a
VK

John wrote:
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>

Sep 19 '06 #3

P: n/a

John написав:
Hi

I have the following in a Perl script. I just want to "clear screen" butit
does not work.
I don't think I've got my client and server sides confused.

Any ideas?

<SCRIPT Language="JavaScript">
moveTo (0,0);
</SCRIPT>

Thank you
John
you can use one of this commands:

location.replace("about:blank")
// or
document.body.innerHTML=""
//or
setTimeout("document.write('')",100)

All of them works, but are almost completaly useless ;)
Maybe you should consider what you want exactly?

Val

Sep 20 '06 #4

P: n/a
Many thanks, everyone.

Yes, the document.body.innerHTML="" was the answer.

Many thanks.

Much appreciated.

John
<sc********@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...

John ???????:
Hi

I have the following in a Perl script. I just want to "clear screen" but
it
does not work.
I don't think I've got my client and server sides confused.

Any ideas?

<SCRIPT Language="JavaScript">
moveTo (0,0);
</SCRIPT>

Thank you
John
you can use one of this commands:

location.replace("about:blank")
// or
document.body.innerHTML=""
//or
setTimeout("document.write('')",100)

All of them works, but are almost completaly useless ;)
Maybe you should consider what you want exactly?

Val
Sep 22 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.