Advertisement
kiril_dishliev

Print html from IFRAME

Nov 18th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.96 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head runat="server">
  5.     <title></title>
  6.     <script>
  7.         function callPrint() {
  8.             document.getElementById("frm1").contentWindow.myPrint();
  9.          // window.frames[0].frameElement.contentWindow.myPrint();
  10.         }
  11.         </script>
  12. </head>
  13. <body>
  14.     <form runat="server">
  15.         <input type="button" onclick="callPrint()" value="Print" />
  16.         <iframe id="frm1" src="http://localhost:4398/HtmlPage1.html" width="1300px;"></iframe>
  17.     </form>
  18. </body>
  19. </html>
  20.  
  21. --------------------------------------------------------------
  22. <!DOCTYPE html>
  23. <html>
  24. <head>
  25.     <title></title>
  26.     <meta charset="utf-8" />
  27.     <script>
  28.         window.myPrint = function () {
  29.             window.print();
  30.         }
  31.     </script>
  32. </head>
  33.  
  34. <body>
  35.     <table>
  36.         <tr>
  37.             <td>
  38.                 dsfgbsdgbdgbsdfg
  39.             </td>
  40.         </tr>
  41.     </table>
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement