Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  11] [ 3]  / answers: 1 / hits: 28888  / 14 Years ago, fri, december 17, 2010, 12:00:00

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



<input type=submit value=Print class=register-button onClick=window.print()/>


In the popup the default filename is the name of the website found it the tags in the header.



Is there anyway I can set a parameter in the function so the default save filename is what ever I want it to be?



Cheers.


More From » printing

 Answers
3

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>




[#94569] Wednesday, December 15, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
darennevina

Total Points: 422
Total Questions: 128
Total Answers: 105

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
;