javascript - Printing Popup Window after loading -
i've spent more 5 hours on this, i'm trying load link on popup window , after loading want print it.
so did following
<script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> function printer(){ var link = 'file:///c:\\page0339.swf'; w = window.open(link, "_blank", "location=1,scrollbars=1,menubar=1,width=600, height=400"); w.onload = function() { this.print(); this.close(); }; } $(document).ready(function () { $("#print").click(function () { printer(); }); }); </script> <input type ="button" id = "print" value = 'print' />
inside onload i've tried alert
message , shows both this.print();this.close();
never called, , didn't see javascript error. how can call print function inside onload??
seems attaching onload after opening window wrong way go. instead of
w.onload = function() { this.print(); this.close(); };
have tried this?
w.print(); w.close();
Comments
Post a Comment