Printing using JavaScript

In this snippet, you will learn how to print the content using JavaScript

 

<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">html</span><span style="color: #0000ff;">&gt;</span>
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">head</span><span style="color: #0000ff;">&gt;</span>
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">script</span> <span style="color: #ff0000;">language</span> = <span style="color: #0000ff;">"javascript"</span><span style="color: #0000ff;">&gt;</span>
<span style="color: #0000ff;">function</span> Toprint() {
Window.Print();
}
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span>
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">head</span><span style="color: #0000ff;">&gt;</span>
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span>
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span> = <span style="color: #0000ff;">"button"</span> <span style="color: #ff0000;">onClick</span> = <span style="color: #0000ff;">"Toprint()"</span>
<span style="color: #ff0000;">value</span> = <span style="color: #0000ff;">"Print"</span><span style="color: #0000ff;">&gt;</span>
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span>
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">html</span><span style="color: #0000ff;">&gt;</span>
READ  Application Insights SDK 0.11.0 Adds Telemetry API, JavaScript Error Collection and Improvements

Leave a Reply

Your email address will not be published.