如題,頁面是用的frame,想實現點擊A頁面的一個按鈕實現B頁面的table動態添加,
我這裡firefox,ie11都沒有問題,chrome通過http訪問也沒有問題
<iframe id="rightFrame" height="300" width="100%" src="x.html"></iframe>
<input type="button" value="addRow" onclick="addRow()" />
<script>
function addRow() {
var topWin = top.document.getElementById('rightFrame').contentWindow;
var list2 = topWin.document.getElementById('planTable');
console.log(list2)
var l = list2.rows.length;
for (var i2 = l - 1; i2 >= 0; i2--) list2.deleteRow(i2);
var row = list2.insertRow(list2.rows.length);
var cell = row.insertCell(0);
cell.innerHTML = '11';
cell = row.insertCell(1);
cell.innerHTML = '22'
cell = row.insertCell(2);
cell.innerHTML = new Date().getTime()
}
</script>
x.html
<table id="planTable" border="1"></table>