javascript:anchor tag problem

Posted by Raam on Stack Overflow See other posts from Stack Overflow or by Raam
Published on 2010-06-16T12:15:07Z Indexed on 2010/06/16 13:42 UTC
Read the original article Hit count: 122

Filed under:
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);
}

i am not able to call the delete function when anchor tag was clicked...what can i want to change to achieve this?

© Stack Overflow or respective owner

Related posts about JavaScript