1
我有以下javascript函数,它创建一个新行,其中包含按钮作为单元格项类型的不同单元格。那么我怎么才能在这里实现按钮功能的onClick
?如何在javascript中实现onclick对象?
我的代码:
var propertyCell = row.insertCell(1);
var propertyName = document.createElement("input");
propertyName.type = "text";
propertyName.size = "6";
propertyName.id = "pName"+rowCount;
//alert(propertyName.size);
propertyCell.appendChild(propertyName);
var image1Cell = row.insertCell(6);
var image1 = document.createElement("input");
image1.type = "button";
image1.value = "Camera";
image1.size = "6";
image1.id = "image1"+rowCount;
//image1.onclick = function(){sdfkvk(dh,sdd)}
image1Cell.appendChild(image1);
this.id.split( 'E1')[1]应该image1.id返回的行数号,{}这将指向按钮。 – kamui
是的..即使这工作正常:)谢谢你 – Smitha