kusnecow,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.red {
background-color: #FF0000;
}
</style>
</head>
<body>
<div class="actions">
<input type="button" name="save" value="сохранить"/>
<input type="button" name="delete" value="удалить"/>
</div>
<script>
window.onload = function(e) {
var buttons = document.querySelectorAll('.actions input');
for (var i = 0; i < buttons.length; i++) {
buttons[i].onclick = btnClick;
}
}
function btnClick(e) {
var name = this.getAttribute('name');
if ( name == 'save') {
this.classList.add("red");
}
else if ( name == 'delete') {
alert(2);
}
}
</script>
</body>
</html>