rkarthik29
asked on
javascript print screen
can we detect using javascript, the pressing of the print screen button, on html web form.
can anyone enlightne me.
Karthik
can anyone enlightne me.
Karthik
ASKER
i meant the printscreen button on ur keyboard.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This will put 2 buttons on yuor screen. The 1st is a PRINT and the 2nd is CLOSE THIS WINDOW (I have it in a popup window).
document.write('<form>'
+ '<input type=button name=print value="Print this page" '
+ 'onClick="javascript:windo w.print()" > '
+ '<input type=button name=close value="Close this page" '
+ 'onClick="javascript:windo w.close()" ></form>') ;
If you do not want the "close this page", just have this:
document.write('<form>'
+ '<input type=button name=print value="Print this page" '
+ 'onClick="javascript:windo w.print()" > '
+ '</form>');
This will print the web page it is on.
If you need any additional info, let us know.
Radnor
document.write('<form>'
+ '<input type=button name=print value="Print this page" '
+ 'onClick="javascript:windo
+ '<input type=button name=close value="Close this page" '
+ 'onClick="javascript:windo
If you do not want the "close this page", just have this:
document.write('<form>'
+ '<input type=button name=print value="Print this page" '
+ 'onClick="javascript:windo
+ '</form>');
This will print the web page it is on.
If you need any additional info, let us know.
Radnor
Radnor,
Please read the question and comments. The member has alredy indicated that is not what they want. They are referring to "printsceern", not the print function of the browser.
Cd&
Please read the question and comments. The member has alredy indicated that is not what they want. They are referring to "printsceern", not the print function of the browser.
Cd&
function window.onbeforeprint(){
}
function window.onafterprint(){
}
but i cannot test things myself - except for the 'print preview' which seems to work okee-, because I haven't got a printer installed on this pc.
regards
-r-