473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how do I 'clear screen''

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
4 25661
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
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

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
0
by: Peter | last post by:
I am just trying to learn python, to use for some fairly basic command line utilities which will run in either Windows/DOS or Linux. I cannot find a platform neutral way of manipulating the screen....
6
by: jcollins | last post by:
Is there a command in Python to clear the screen? That is without writing multiple blank lines. Thanks. Jim C
18
by: Tim Mierzejewski | last post by:
How do I clear the text from my screen, other than a bunch of \n's or endl's? Tim M.
6
by: KL | last post by:
I was thinking...not always a good thing...is there a way to clear your screen. Like my current program asks a question and then posts 6 possible answers to choose from. Once a valid answer is...
20
by: ritchie | last post by:
Hi, I am trying to clear the screen in my program. I am loking for something that will work on all compilers, especially Borland & MS Visual Studio 6. On Visual studio I used 'system("cls");'...
22
by: mp | last post by:
i have a python program which attempts to call 'cls' but fails: sh: line 1: cls: command not found i tried creating an alias from cls to clear in .profile, .cshrc, and /etc/profile, but none...
2
by: nickyeng | last post by:
i have a function that clear the screen and then display array to cout. i compiled no error no warning, i run it, the screen really get "clear" but it does not display anything to cout, and it...
1
by: sganeshsvk | last post by:
i want to clear the screen command prompt for mysql in windows XP... In linux we use (CTRL + L) for clear the screen in mysql prompt.... i already use this command ( \c ) then ( \! clear ) for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.