Skip to content Skip to sidebar Skip to footer

Javascript Print Function - File Name

I am using the window.print() function in javaScript to print a page which is executed from a button onClick.

Solution 1:

onClick="document.title = 'My new title';window.print();"

You can try it here:

    <html>
    <head>
    <title>My title</title>
    </head>
    <body>
    <button onClick="document.title = 'My new title';window.print();">Try it</button>
    <p id="demo"></p>
    </body>
    </html>

Solution 2:


Post a Comment for "Javascript Print Function - File Name"