<input type="button" value="Вася"/>
<input type="button" value="Петя"/>
<input type="button" value="Коля"/>
<div>
<h1 id="h1">*нужный_текст*</h1>
</div>
var buttons = document.getElementsByTagName("input");
for(var i = 0; i < buttons.length; i++) {
buttons[i].onclick = function(){
document.getElementById("h1").innerHTML = this.value;
}
}
http://jsfiddle.net/BETEPAH/zKSSu/