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
use the following binary search tree to answer the questions. a. how many comparisons are needed to search for ""2"" in this tre
Nesterboy [21]

A data structure called a binary search tree makes it simple to keep track of a sorted list of numbers.

<h3>What is a binary search tree?</h3>

A binary search tree, also known as an ordered binary tree or a sorted binary tree in computer science, is a rooted binary tree data structure where each internal node's key is higher than all the keys in its left subtree and less than all the keys in its right subtree.

A data structure called a binary search tree makes it simple to keep track of a sorted list of numbers. Because each tree node has a maximum of two offspring, it is known as a binary tree. It can be used to search for the presence of a number in O(log(n)) time.

A binary search tree (BST) is a specific type of binary tree in which every node has a comparable key and a connected or associated value.

To learn more about binary search trees refer to:

brainly.com/question/28295292

#SPJ4

6 0
1 year ago
A10:A20 Refer to values in
Keith_Richards [23]
The range of cells in column A and rows 10 through 20
8 0
2 years ago
In Florida, no-fault insurance is
konstantin123 [22]

Answer:

mandatory for all drivers

Explanation:

It is mandatory for all drivers since January 1, 2008. Florida is among the 12 states that follow the no-fault insurance laws, and under the no-fault insurance laws, all the drivers must follow a certain set of rules like $10000s coverage law. And hence the second option is not the correct option which states $5000s. And its $10000s. And it's true for all ages and not 21. And it is never optional. Hence, the first option is the correct option.

5 0
2 years ago
Default color html ​
Marrrta [24]

Answer:

black for font...

and

white for bg color

Explanation:

i think this is enough for ur question...

3 0
3 years ago
Most simple computer programs follow the basic pattern defined by the acronym IPO. What does IPO mean with regards to programmin
Art [367]

Answer:

IPO means Input - Process - Output

Explanation:

The IPO model means that a computer program is given an input to process, it processes the given input and return an output as the result.

3 0
3 years ago
Other questions:
  • Your health insurance company gives you a discount if you wear a fitness-tracking bracelet. After wearing it for a few months, y
    5·1 answer
  • List the general steps that are used to configure a soho router and set up the network
    13·1 answer
  • A network technician is setting up a wireless access point in the front office of a small company. The technician needs to disab
    14·1 answer
  • Which course must first-time drivers in Florida take to be eligible for their Learner License?
    11·1 answer
  • 1. If an F# function has type 'a -&gt; 'b when 'a : comparison, which of the following is not a legal type for it? Select one:
    14·1 answer
  • What console can be used to enable disable start or stop a service
    6·1 answer
  • Write down the bit pattern in the fraction of value 1/3 assuming a floating point format that uses Binary Coded Decimal (base 10
    10·1 answer
  • The BaseballPlayer class stores the number of hits and the number of at-bats a player has. You will complete this class by writi
    6·1 answer
  • Which operating system function has a steeper learning curve and can potentially break the system without careful use of its ope
    7·1 answer
  • I want to build a video player on the html5 canvas here is my code
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!