嘿傢伙我試圖創建一個窗口,當我點擊主文檔中的一個表列的特定數字,並對應於該列中的行打開在一個窗口打開不同的窗口。用於刪除主文檔中的行的腳本正在運行,但相同的腳本在打開的窗口中似乎不起作用。我不知道問題是什麼。請幫我出來。謝謝。JavaScript不工作在空白窗口
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>');
什麼是在新窗口中的輸出增加基本的HTML標記,如
<html>
和<body>
? – 2012-02-27 11:19:57在'document.write'中設置結尾'SCRIPT'標籤,如下所示:'<\/SCRIPT>',否則原始腳本將停止。 – Teemu 2012-02-27 11:22:36