JavaScript Reference/Event Handlers Reference/onBeforePrint

Материал из Web эксперт
Перейти к: навигация, поиск

"onBeforePrint" Example

    
<head>
<script language="JavaScript">
   function function1() {
       window.print(); 
    } 
</script>
</head>
<body onbeforeprint="alert("This page is about to be printed")">
    <p>Some body Content to print.</p>
    <input type="button" value="Print" onclick="function1()">
</body>
</html>



"onBeforePrint" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<body>                          <frameset>                    |
|                |window                                                        |
+----------------+--------------------------------------------------------------+



"onBeforePrint" Properties

+----------------+--------------------------------------------------------------+
| Properties     |altKey                          altLeft                       |
|                |button                          cancelBubble                  |
|                |clientX                         clientY                       |
|                |ctrlKey                         ctrlLeft                      |
|                |returnValue                     screenX                       |
|                |screenY                         shiftKey                      |
|                |shiftLeft                       srcElement                    |
|                |type                            x                             |
|                |y                                                             |
+----------------+--------------------------------------------------------------+



"onBeforePrint" Syntax and Note

Note:
    
This event fires before the document prints.