Thanks Philippe for correcting me.<br>After some modifications the Js code is<br><br><br>printwindowJs<br> ^ '<br>function chkstate(){<br>if(document.readyState=="complete"){window.close()}<br>else{setTimeout("chkstate()",2000)}}
<br><br>function print_win(){<br>window.print();chkstate();}<br> <br> <br> function printContent(id){<br>str=document.getElementById(id).innerHTML<br>newwin=window.open('''',''printwin'',''left=100,top=100,width=400,height=400'')
<br>newwin.document.write(''<HTML>\n<HEAD>\n'')<br>newwin.document.write(''<TITLE>Print Page</TITLE>\n'')<br>newwin.document.write(''</HEAD>\n'')
<br>newwin.document.write(''<BODY onload="print_win()">\n'')<br>newwin.document.write(str)<br>newwin.document.write(''</BODY>\n'')<br>newwin.document.write(''</HTML>\n'')
<br>newwin.document.close()<br>}<br><br>'<br><br><br>Now, I am getting a popup browser with the div rendered in it. But the automatic printerSelection menu is not coming. I hope I am closer than last time.<br><br>Regards,
<br>Rajeev<br><br><div class="gmail_quote">On Jan 2, 2008 11:47 PM, Philippe Marschall <<a href="mailto:philippe.marschall@gmail.com">philippe.marschall@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2008/1/2, Rajeev Lochan <<a href="mailto:lochan94@gmail.com">lochan94@gmail.com</a>>:<br><div><div></div><div class="Wj3C7c">> Hi,<br>> One of the hurdles I am facing is printing only a part of the page/ a<br>
> particular html div. By googling, I tried to do the following steps, but<br>> still not able to succeed.<br>><br>> I followed instruction given in<br>> <a href="http://www.huntingground.freeserve.co.uk/main/mainfram.htm?../scripts/printing.htm" target="_blank">
http://www.huntingground.freeserve.co.uk/main/mainfram.htm?../scripts/printing.htm</a><br>><br>> 1) created a Javascript printWindow.js with the Js code mentioned there.<br>><br>> MyLibrary>>printwindowJs
<br>> ^ '<script type="text/javascript"><br>> <!--<br>> function printContent(id){<br>> str=document.getElementById(id).innerHTML<br>> newwin=window.open('''',''printwin'',''left=100,top=100,width=400,height=400'')
<br>> newwin.document.write(''<HTML>\n<HEAD>\n'')<br>> newwin.document.write(''<TITLE>Print Page</TITLE>\n'')<br>> newwin.document.write(''<script>\n'')
<br>> newwin.document.write(''function chkstate(){\n'')<br>> newwin.document.write(''if(document.readyState=="complete"){\n'')<br>> newwin.document.write(''window.close
()\n'')<br>> newwin.document.write(''}\n'')<br>> newwin.document.write(''else{\n'')<br>> newwin.document.write(''setTimeout("chkstate()",2000)\n'')
<br>> newwin.document.write(''}\n'')<br>> newwin.document.write(''}\n'')<br>> newwin.document.write(''function print_win(){\n'')<br>> newwin.document.write(''
window.print();\n'')<br>> newwin.document.write(''chkstate();\n'')<br>> newwin.document.write(''}\n'')<br>> newwin.document.write(''<\/script>\n'')<br>
> newwin.document.write(''</HEAD>\n'')<br>> newwin.document.write(''<BODY onload="print_win()">\n'')<br>> newwin.document.write(str)<br>> newwin.document.write
(''</BODY>\n'')<br>> newwin.document.write(''</HTML>\n'')<br>> newwin.document.close()<br>> }<br>> //--><br>> </script>'<br><br></div></div>Why do you put <script>-Tags in JavaScript code?
<br><br>Cheers<br>Philippe<br><div><div></div><div class="Wj3C7c"><br>> 2) Added the above Js in #updateRoot: of my rootComponent<br>><br>> MyRoot>>updateRoot: anHtmlRoot<br>> super updateRoot: anHtmlRoot.
<br>> anHtmlRoot javascript url:<br>> '/seaside/files/ToDoLibrary/printwindow.js'<br>><br>><br>> 3) MyRoot>>renderContentOn: html<br>><br>> html div id: 'div1'; with: [ ........... ].
<br>> html div id: 'div2'; with: [ ........... ].<br>> html div id: 'div3'; with: [ ........... ].<br>> html div id: 'div4'; with: [ html text: 'Print this Div'.<br>> html space.
<br>> html html: '<a<br>> href="#null" onclick="printContent( ' 'div4' ' );">Click to print div<br>> 4</a>'.<br>><br>> html anchor url: '#'; onClick: 'printContent( ' 'printListView' ' )';
<br>> with: 'Print div 4 ' .<br>><br>> I have used both raw html code and modified Seaside/squeak code (I hope its<br>> equivalent). When I click on any of the anchors, nothing happens. I get the
<br>> following error in Firebug(firefox)<br>><br>> printContent is not defined<br>> onclick (click clientX=0, clientY=0)<br>><br>><br>> I crosschecked the inclusion of printwindow.js and it is indeed included in
<br>> the Firebug Js browser.<br>><br>> I hope you people can help me where I am committing a dumb mistake(maybe) or<br>> is there a better way to print only a div.<br>><br>> Thanks & Regards,<br>> Rajeev
<br>><br>><br>><br>> --<br>> Rajeev Lochan<br>><br>> Co-founder, AR-CAD.com<br>><br>> <a href="http://www.ar-cad.com" target="_blank">http://www.ar-cad.com</a><br>> +91 9243468076 (Bangalore)
<br>> 080 65355873<br></div></div>> _______________________________________________<br>> seaside mailing list<br>> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>><br>><br>_______________________________________________
<br>seaside mailing list<br><a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
</a><br></blockquote></div><br><br clear="all"><br>-- <br>Rajeev Lochan<br><br>Co-founder, AR-CAD.com<br><br><a href="http://www.ar-cad.com">http://www.ar-cad.com</a><br>+91 9243468076 (Bangalore)<br>080 65355873