javascript:anchor tag problem
<pre><code>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);
}
</code></pre>

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