I am stuck at the simple JavaScript function, related to the checkbox validation. I need to document.write if the cb1 is checked, and the same if cb2. And if both, or one of them isn't checked, then write nothing.
<html>
<head>
<title>TEST PAGE</title>
<script type="text/javascript" src="submit.js"></script>
</head>
<body>
<div style="width:100%"><input type="checkbox" id="cb1"></div>
<div style="width:100%"><input type="checkbox" id="cb2"></div>
<div style="width:100%"><input type="submit" name="execute" id="execute" value="Execute" onClick="run();"></div>
</body>
</html>
submit.js
function run() {
document.write('<div>' + "HERE GOES YOUR CHECKBOX CHOICE: " + '</div>');
if(document.getElementById("cb1").checked == true) {
document.write("This is check box 1");
}
if(document.getElementById("cb2").checked == true) {
document.write("This is check box 2");
}
}