Click to See Complete Forum and Search --> : pulling the table to a New Window in NS4.5


prabhu_cg
05-27-2003, 03:19 AM
Note :

This is Very urgent.


I want to extract the table into new window using javascript.
The following Javascript works in IE 5 and Netscape 6.0 & above. It is not working in Netscape 4.5. I want the equivalent script for Netscape 4.5. Do you have any idea.

<html>
<script language="Javascript">
function extractTable(tabid)
{
var newwin=window.open("");
var getid=document.getElementById(tabid);
newwin.document.writeln("<table border='1'>");
newwin.document.writeln(getid.innerHTML);
newwin.document.writeln("</table>");
}
</script>
<body>
<table id="tab" border="1">
<tr>
<td>One</td><td>Two</td>
</tr>
<tr>
<td>One</td><td>Two</td>
</tr>
</table>
<form>
<input type="button" value="Click" onclick="extractTable('tab')"/>
</form>
</body>
</html>

requestcode
05-27-2003, 07:46 AM
Unfortunately Netscape version 4 browsers do not support innerHTML. The only way I know of with JavaScript would be to recreate the table using document.write() statements. You would have to rewrite the whole table to the window.