3
rated 0 times
[
7]
[
4]
/ answers: 1 / hits: 49329
/ 12 Years ago, sun, june 3, 2012, 12:00:00
Why in the code below upon the call of document.write
in the function validator()
the form elements (the checkbox and button) are removed from screen?
<!DOCTYPE html>
<html>
<head>
<script type=text/javascript>
function validator() {
if (document.myForm.thebox.checked)
document.write(checkBox is checked);
else
document.write(checkBox is NOT checked);
}
</script>
</head>
<body>
<form name=myForm>
<input type=checkbox name =thebox/>
<input type=button onClick=validator() name=validation value=Press me for validation/>
</form>
</body>
</html>
More From » html