<html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("myCheck").name;
alert(x);
}
</script>
</head>
<body>
<form>
<input type="checkbox" name="check1" id="myCheck">Do you like summer?
</form>
<button type="button" onclick="displayResult()">Display name</button>
</body>
</html>