<script>
function check(it) {
    /*
    if (it.name == "b1") {
        alert("button one clicked.");
    }
    if (it.name == "b2") {
        alert("button two clicked.");
    }
    */
    /* Or */
    
    if (it.value == "One") {
        alert("button one clicked.");
    }
    if (it.value == "Two") {
        alert("button two clicked.");
    }
}
</script>
<input type="button" name="b1" value="One" onclick="check(this);"/>
<input type="button" name="b2" value="Two" onclick="check(this);"/>