0
I have been working on this for a while and I don’t know why its not working properly. It seems that no matter what value I put into the input boxes it comes with the same value when it is not meant to change depending on the true or false values. It should follow the rules of truth tables with AND, OR, and XOR statements. I haven’t done any of the XOR code yet because I want to solve this issue first. Any ideas why it keeps giving me the same output no matter what? var binary = document.getElementById("binary").value; var binarytwo = document.getElementById("binarytwo").value; function truefalse(){ if (binary == 1 && binarytwo == 1){ document.getElementById("and").innerHTML = "1 or TRUE" }else{ document.getElementById("and").innerHTML = "0 or FALSE" } if (binary == 1 || binarytwo == 1){ document.getElementById("or").innerHTML = "1 or TRUE" }else if (binary == 1 || binarytwo == 0){ document.getElementById("or").innerHTML = "1 or TRUE" }else if (binary == 0 || binarytwo == 1){ document.getElementById("or").innerHTML = "1 or TRUE" }else{ document.getElementById("or").innerHTML = "0 or FALSE" } } <!DOCTYPE html> <html> <head> <h1>Logic Gates</h1> <br> </head> <body> <h1>Write two Binary Values</h1> <br> <input id = "binary">Type a 0 or 1 here <br> <input id = "binarytwo">Type a 0 or 1 here <br> <button onclick = "truefalse()">"Click Here to get the Statements"</button> <p id="or">OR Statement</p> <p id="and">AND Statement</p> <p id="xor">XOR Statement</p> </body> </html>