Here is a little JavaScript true or false script that you can have some fun with. You can even develop further intricate programs off of this little script here. Enjoy!



<html>
<head>
<title>Quiz</title>
</head>
<body>
<h1>Quiz</h1>
<div id="question">True or False: The sky is blue?</div>
<button onclick="truee()">True</button>
<button onclick="falsee()">False</button>
<script>
function truee(){
document.getElementById('question').innerHTML="That is correct";
document.getElementById('question').style.color="green";
document.getElementById('question').style.textTransform="uppercase";
}

function falsee(){
document.getElementById('question').innerHTML="That is not correct";
document.getElementById('question').style.color="red";
document.getElementById('question').style.textTransform="uppercase";
}
</script>
</body>
</html>


Sign Up To Comment