Hello - Is there a way to print html without using document.print -OR- is there a way to force document.print to print html inside of existing tags?
Let me explain - I have a PERL/CGI script that I am using some basic Javascript to enable onClick and onChange type functionality. The problem is that one of my JavaScript functions needs to print some html, but when using document.print, it over-writes all of the existing html code in the page and ONLY prints out the html the document.print function is printing. I would like this function to print out the html inside of a <div> tag. Here is the JavaScript function that I am using:
***please ignore the print commands at the beginning of the lines, that is the perl prints to print out the JavaScript as well as the \n"; at the end of the line***
128 print "function print_cim(){\n";
129 print " _num = document.myform.number.val
ue;\n";
130 print " for(var \$count = 0; \$count < 25; \$count++){\n";
131 print " document.write(\"<tr>\")\n
";
132 print " document.write(\"<td width=20% align=center>\")\n";
133 print " document.write(\"<select name=('cim_add'+\$count)>\
")\n";
134 print " document.write(\"<option><
/option>\"
)\n";
135 print " document.write(\"<option value='add'>Add</option>\"
)\n";
136 print " document.write(\"<option value='del'>Delete</option
>\")\n";
137 print " document.write(\"<option value='chg'>Change</option
>\")\n";
138 print " document.write(\"<select>\
")\n";
139 print " document.write(\"<td width=25%>\")\n";
140 print " document.write(\"<input type='text' size='40' name=('cim_node'+\$count)>
\")\n";
141 print " document.write(\"<td width=55%>\")\n";
142 print " document.write(\"<input type='text' size='80' name=('cim_notes'+\$count)
>\")\n";
143 print " document.write(\"<td></tr>
\")\n";
144 print " }\n";
145 print "}\n";
Thanks for your help!!
~Mike
Start Free Trial