<!DOCTYPE html>
<html>
<head>
<meta charset="windows-1251" />
</head>
<body>
<input id="one" type="checkbox" />
<input id="two" type="checkbox" />
<button onclick="check('one')">check1</button>
<button onclick="check('two')">check2</button>
<script>
function check (id) {
var zam=document.getElementById(id)
if (zam.checked) alert(zam.id)
}
</script>
</body>
</html>