Hey guys i’m trying to create a window which opens up when i click a particular numbers of a table column in the main document and corresponding to that the rows in that column open up in a different window. The script to delete the rows in the main document is working but the same script does not seem to work in the window that opens up. I dont know what the problem is.Please help me out here.Thanks.
Window = window.open('','W1','width=700,height=500');
//Window.document.write("<style type='text/css'>table,th,tr{ cellspacing=0;border- collapse:collapse;border-radius:5px;-moz-border-radius:5px;}</style>");
Window.document.write('<table id="T1" border="1" ><th width="60">S,no.</th><th width="110">Name</th><th width="110">Op Name</th><th width="110">ID</th><th width="110">Synonym record numbers</th><th width="60">Total Duplicity weight</th><th></th></table>');
Window.document.write("<button type=\"button\" value=\"delal\" id=\"delal\" name=\"delal\" onclick=\"delall()\">Delete checked</button>");
Window.document.getElementById("T1").style.borderCollapse="collapse";
Window.document.getElementById("T1").style.padding="5";
Window.document.getElementById("T1").style.backgroundColor="#E0C77A";
Window.document.getElementById('T1').innerHTML += F+M;
Window.document.write('<script type="text/javascript">function deleteRow1(i) {if(confirm("Confirm to Delete??")document.getElementById("T1").deleteRow(i);}function delall(){if(confirm("Are you sure you want to delete the selected rows?")){crows=document.getElementsByName("delcheck");for (i = 0; i<crows.length;i++){if(crows[i].checked){document.getElementById("T1").deleteRow(crows[i].parentNode.parentNode.rowIndex);i--;}}}</script>');
Debugged last line:
Notice also JamieJag’s answer, and my comment to that answer. That means, that you have to build up the whole HTML-page by script, using closing tags too. And when you have the stylesheet, you can also remove all inner style settings, and also put in the
document.writethe ìnnerHTML. These are not going to work anyway during page parsing.Finally add the last line to the script:
Window.document.close();