All pastes #802491 Raw Edit

Someone

public text v1 · immutable
#802491 ·published 2007-11-30 09:51 UTC
rendered paste body
var divIDcounter=0;

function add()
{
 var newdiv,linkob,link,contents;
 newdiv=document.createElement('div');
 contents=document.createTextNode('New Div LOLOMG');
 linkob=document.createElement('a');
 link=document.createTextNode('[rem]');
 linkob.href='#';
// linkob.setAttribute('onclick','rem()');
 linkob.onclick=rem;
 linkob.appendChild(link);
 newdiv.appendChild(contents);
 newdiv.appendChild(linkob);
 newdiv.setAttribute('name',newId());
 // Add box
 alert(linkob.onclick);
 document.body.appendChild(newdiv);
 return true;
}
function rem()
{
 parentNode.removeChild(this);
}

function newId()
{
 divIDcounter = divIDcounter+1;
 return divIDcounter;
}