Hi,<br>One of the hurdles I am facing is printing only a part of the page/ a particular html div. By googling, I tried to do the following steps, but still not able to succeed.<br><br>I followed instruction given in <a href="http://www.huntingground.freeserve.co.uk/main/mainfram.htm?../scripts/printing.htm">
http://www.huntingground.freeserve.co.uk/main/mainfram.htm?../scripts/printing.htm</a><br><br><b>1) created a Javascript printWindow.js with the Js code mentioned there.</b><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 clear="all"><br><br><b>2) Added the above Js in #updateRoot: of my rootComponent</b><br><br>MyRoot>>updateRoot: anHtmlRoot <br> super updateRoot: anHtmlRoot.<br> anHtmlRoot javascript url: '/seaside/files/ToDoLibrary/printwindow.js'
<br><br><br><b>3) MyRoot>>renderContentOn: html</b><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 href="#null" onclick="printContent( ' 'div4' ' );">Click to print div 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 equivalent). When I click on any of the anchors, nothing happens. I get the following error in Firebug(firefox)
<br><br><div style="color: rgb(255, 0, 0);" class="errorTitle"><b>printContent is not defined</b></div><div class="objectBox objectBox-stackFrame"><b><a style="color: rgb(255, 0, 0);" class="objectLink">onclick</a><span style="color: rgb(255, 0, 0);">
(</span><a style="color: rgb(255, 0, 0);" class="objectLink objectLink-object">click clientX=0, clientY=0</a><span style="color: rgb(255, 0, 0);" class="arrayComma"></span><span style="color: rgb(255, 0, 0);">)</span></b>
<br><br><br>I crosschecked the inclusion of printwindow.js and it is indeed included in the Firebug Js browser.<br><br>I hope you people can help me where I am committing a dumb mistake(maybe) or is there a better way to print only a div.
<br><br>Thanks & Regards,<br>Rajeev<br></div><br><br><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