Вот так делай
function div(){
var con=mk_div('con');
con.addEventListener('mousedown', mDown);
con.addEventListener('mouseup', mUp);
document.addEventListener('mousemove', mMove);
}
function mk_div(rule){
var div = document.createElement('div'),
style=div.style;
style.width='100px';
style.height='100px';
style.backgroundColor="green";
div.className=rule;
return document.body.insertBefore(div, document.body.firstChild)
}
btn.onclick = div;