我試圖用JavaScript來行添加到動態使用下面的代碼表設置style.property到一個textarea:通過JavaScript
function addRowToTable()
{
var tbl = document.getElementById('targets');
var lastRow = tbl.rows.length;
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
var cellRight = row.insertCell(1);
var el = document.createElement('textarea');
el.name = 'target' + iteration;
el.id = 'target' + iteration;
el.style.property="margin:4px; max-width:400px; width:400px; max-height:35px; height:35px;";
cellRight.appendChild(el);
}
一切正常,除了el.style.property
。我曾嘗試過el.style
。
這怎麼解決?