Print table javascript rendered as plain text
I am trying to print a table using javascript
the html table looks like this:
<table id="rounded" runat=server summary="2007 Major IT Companies' Profit" style="position:relative;left:-45px;" >
<tr>
<th scope="col" class="rounded-company">header1</th>
<th scope="col" class="rounded-q1">header2</th>
<th scope="col" class="rounded-q1">header3</th>
<th scope="col" class="rounded-q1">header4</th>
<th scope="col" class="rounded-q1">header5</th>
<th scope="col" class="rounded-q1">header6</th>
<th scope="col" class="rounded-q1">header7</th>
<th scope="col" class="rounded-q1">header8</th>
<th scope="col" class="rounded-q1">header9</th>
<th scope="col" class="rounded-q4"> header10</th>
</tr>
</table>
I am giving the data of the throw ajax table, so in the end the table looks like this:
<table id="rounded" runat=server summary="2007 Major IT Companies' Profit" style="position:relative;left:-45px;" >
<tr>
<th scope="col" class="rounded-company">header1</th>
<th scope="col" class="rounded-q1">header2</th>
<th scope="col" class="rounded-q1">header3</th>
<th scope="col" class="rounded-q1">header4</th>
<th scope="col" class="rounded-q1">header5</th>
<th scope="col" class="rounded-q1">header6</th>
<th scope="col" class="rounded-q1">header7</th>
<th scope="col" class="rounded-q1">header8</th>
<th scope="col" class="rounded-q1">header9</th>
<th scope="col" class="rounded-q4"> header10</th>
</tr>
<tr>
<td>value1</td>
<td>value2</td>
<td>value3</td>
<td>value4</td>
<td></td>
<td>value6</td>
<td>value7</td>
<td>value8</td>
<td>value9</td>
<td>value10</td>
</tr>
<tr>
<td>value1</td>
<td>value2</td>
<td>value3</td>
<td>value4</td>
<td></td>
<td>value6</td>
<td>value7</td>
<td>value8</td>
<td>value9</td>
<td>value10</td>
</tr>
</table>
I am using javascript to print a table like this:
<script type="text/javascript">
function printTable()
{
var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting += "scrollbars=yes,width=1350, height=800";
var content_vlue = $("#rounded").html();
var docprint = window.open("", "", disp_setting);
docprint.document.open();
docprint.document.write('<link href="css/table2.css" type="text/css" rel="stylesheet" />');
docprint.document.write('<html><head><title>Inel Power System</title>');
docprint.document.write('</head><body onLoad="self.print()"><center>');
docprint.document.write(content_vlue);
docprint.document.write('</center></body></html>');
docprint.document.close();
docprint.focus();
}
</script>
the problem is the table is printed as inner text instead of innerhtml (no rows without columns without header)
If I take this table (from page source) and try to print it (no ajax) it works fine.
What could be the problem?
Thank you for any help
+3
source to share
1 answer