Alekosh,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
document.addEventListener( "DOMContentLoaded" , function() {
let elem = document.querySelector('#elem');
let btn = document.querySelector('#btn');
let p = document.querySelector('#p');
btn.addEventListener('click', func);
function func(){
p.innerHTML += elem.checked ? ' Привет' : ' Пока'
}
});
</script>
</head>
<body>
<input type="checkbox" id="elem">
<input type="submit" id="btn">
<p id="p">text...</p>
</body>
</html>