function main(){
var delImage=document.createElement("img");
delImage.setAttribute("alt","Edit");
delImage.setAttribute("src","drop.png");
var position=newRow.rowIndex;
var typeElem=document.createElement("a");
typeElem.setAttribute("name","delete");
typeElem.setAttribute("href","#");
typeElem.appendChild(delImage);
typeElem.setAttribute('onclick',"delete(position)");
newRow.insertCell(lastCell).appendChild(typeElem);
}
function delete(pos){
alert(pos);
}
当锚点标记被点击时,我无法调用删除功能...我想要改变什么来实现这个功能?javascript:定位标记问题
感谢汤姆和拉胡尔·汤姆的答案完全吻合我的recquirement – Raam 2010-06-16 13:11:27
为什么我们可以传递一个值这样的,而不是基本的方法是什么?如果我想传递一个值,这样意味着/ *位置= 1 + “RAAM”; * /(postion = 1raam)..怎么可以这个?谢谢。 – Raam 2010-06-21 13:11:03
我们没有像这样传递一个值,我们正在获取变量的字面值并将其赋值给属性函数调用,如果这是有道理的话。很难解释,也许别人可以做得更好。 – 2010-06-22 00:05:16