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
A cyberbully is someone who invades another person’s privacy by
e-lub [12.9K]
Insulting or harassing them over the Internet
8 0
4 years ago
Read 2 more answers
3. What do you need to do before you can sort and filter data in a database?
Digiron [165]

3. format the table

4. idk

5 0
3 years ago
Which was the first home game console to be launched?
Makovka662 [10]

Answer:

B: Odyssey

Explanation:

Odyssey, by Magnavox, was the first console ever made.

4 0
3 years ago
Read 2 more answers
Information is stored on a compact disk in a coded pattern of tiny pits arranged in a track that spirals outward toward the rim
Maksim231197 [3]

Answer:

(i) The rotation speed must stay the same.

(ii) The rotation speed must increase.

(iii) The rotation speed must decrease.

Explanation:

According to Equation

10.10, the angular speed must therefore vary as the laser–lens system moves

radially along the disc. In a typical CD player, the constant speed of the surface at

the point of the laser–lens system is 1.3 m/s.

5 0
3 years ago
The following algorithm computes the average height for a list of basketball player heights. Initialize a variable sum to 0. For
prisoha [69]

Answer:

Sequencing and Iteration

Explanation:

Sequencing is a part of all programs, as it's just the fact that computers execute programs in a particular sequence (like top to bottom line in a simple program).

Iteration on the other hand is when we use loops to repeat code in a program.

6 0
4 years ago
Read 2 more answers
Other questions:
  • A (n) _____ exposure is a short term or brief exposure that may create an immediate health hazard
    9·1 answer
  • A _____________ is used to make a deep copy of an object.
    6·1 answer
  • A motherboard has four DIMM slots; three slots are gray and the fourth is black. What type of memory is this board designed to u
    6·1 answer
  • g 18.6 [Contest 6 - 07/10] Reverse an array Reversing an array is a common task. One approach copies to a second array in revers
    8·1 answer
  • A folder can contain only files? A. True B.False
    10·2 answers
  • Which of the file names below follows standard file naming convention?
    12·2 answers
  • Can somebody help I need it now please and thank you correct answer please
    10·2 answers
  • Someone places a chocolate bar near a working radar set that is used to locate ships and airplanes. Which best describes what is
    15·2 answers
  • There are some network modeling tools that can ________ the existing network.
    12·2 answers
  • When running the following code:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!