1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vera_Pavlovna [14]
3 years ago
8

How to Print output in JavaScript

Computers and Technology
1 answer:
katrin [286]3 years ago
8 0

If you want to print on a page you can use

document.write();

If you want to write in console then there are multiple options

console.log() - to log information

console.error();- to log errors

console.warn(); - to log warning message

If you want to popup some information the you can use -

alert(message);

there are also various options present in alert.

or

print() essentially just calls up the native print dialog for a given window.

But as you're are thinking, it will work on any window or (i)frame.

thus if you write content to a frame, you can then call this to print it.

window.frameName.print();

note the only drawback (and its a big one), is that this calls up the print dialog... not the print preview window... thus the user doesn't really get a chance to see what they are printing and/or scale it to fit their printer/paper.

I personally wish that all browsers would implement the following to handle the above issue.

window.printPreview();

Hope this will help !!!

You might be interested in
Format Painter is used to copy formatting from one location to another.<br> true<br> false
Readme [11.4K]
True

Hope this helps!
4 0
3 years ago
Which of these sedimentary rocks is made of the largest particles?
Marta_Voda [28]
Your answer is <span>A.conglomerate.

Hope this helps :)</span>
6 0
3 years ago
Which of the following sets of data would be represented best in histogram?
wariber [46]
I think it would be B. The average monthly sales for the big toy company because its giving data over history
7 0
4 years ago
Read 2 more answers
When an object reflects all the light which falls on it it's color will be
lara31 [8.8K]
A- White. shows all wavelengths of light.
4 0
3 years ago
Read 2 more answers
Which is the most used operating system? A. Windows B.Linux C.Leopard D. DOS
Neko [114]
I think it´s either A. or  B.
7 0
3 years ago
Read 2 more answers
Other questions:
  • Please help me ! All you do is just put it it all in your own words ! Please this is for my reported card!i don't know how to pu
    15·1 answer
  • Please help me please
    6·1 answer
  • HELPPPP!!
    8·2 answers
  • Attribute variables have the same meaning as participants variables. is this true or false?​
    14·1 answer
  • In addition to explaining the paper’s topic, a thesis statement provides instructions on how to read the paper. explains why the
    10·2 answers
  • If you delete a conversation many times with someone like this, will you stop receiving messages from them?
    13·1 answer
  • Select the correct answer from each drop-down menu. What are the effects of emerging technology? has brought the internet to alm
    10·1 answer
  • A type of user interface that features on- screen objects, such a menus and icons, manipulated by a mouse.
    7·1 answer
  • Which system provides an easier way for people to communicate with a computer than a graphical user interface (GUI)
    6·1 answer
  • What is one of four key principles of Responsible Artificial Intelligence
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!