javascript - Print data attribute of object tag -
i trying setup system can call browser's print function print data attribute of object tag. i.e. have object tag pdf content, , want way when press button can print pdf.
this have.
<head> <script type="text/javascript"> function printme () { var test = document.getelementbyid('pdf'); test.focus(); test.print(); } </script> </head> <body> <object data="test.pdf" type="application/pdf" id="pdf"></object> <button onclick="printme()">print!</button> </body>
now keep getting error, uncaught typeerror: undefined not function
when click button. doing wrong here , how set properly?
Comments
Post a Comment