I have a js script that creates a print version for all my pages.
I add an ID where there is content and this is what I will see on the print versio page.
Now the problem is: I want to print 2 elements from my page.
I get some error
Can someone look at it pls and help me out
ORIGINAL CODE:
now I want to add another id to another div cause I also want it to be printed.Code:<script>function print1() { var pre='<html><head>' + '<style>body, div, table{font-family : arial ; }</style>' + '</head><body>' var post="</body></html>" var gwin=open('print.html','hi','width=730,height=500,menubar,scrollbars') var obj = pre + document.getElementById("scroll1").innerHTML + post ; gwin.document.write(obj) ; gwin.document.close() ; gwin.focus } </script> <div id="scroll1">text to be printed</div> <a href="Javascript:print1()" > Print Version</a>
I did this but it doesnt work:
WHAT IS WRONG WITH IT??Code:<script>function print1() { var pre='<html><head>' + '<style>body, div, table{font-family : arial ; }</style>' + '</head><body>' var post="</body></html>" var gwin=open('print.html','hi','width=730,height=500,menubar,scrollbars') var obj = pre + document.getElementById("scroll1").innerHTML + post ; var obj = pre + document.getElementById("scroll2").innerHTML + post ; gwin.document.write(obj) ; gwin.document.close() ; gwin.focus } </script> <div id="scroll2">image to be printed</div> <div id="scroll1">text to be printed</div> <a href="Javascript:print1()" > Print Version</a>



Reply With Quote

Bookmarks