Еще можно так:
<!DOCTYPE HTML>
<html>
<head><meta charset="windows-1251" /> </head>
<body>
<button>foo</button>
<script>
mkButton=function(innerHTML){
var button=document.createElement("button")
button.innerHTML=innerHTML
document.body.appendChild(button)
}
mkThreeButtons=function(innerHTML){
return function(){
mkButton(innerHTML)
mkButton(innerHTML)
mkButton(innerHTML)
}
}
document.querySelector("button").onclick=mkThreeButtons("foo")
</script>
</body>
</html>