I think you are trying to access the value of the TextBox, try this:
var x = document.getElementById("t1").value;
var y = document.getElementById("t2").value;
also change the HTML tag of “t2”:
<input type="text" class="typing2" name="txt2" id="t2" oninput="this.value = this.value.toUpperCase()" onkeyup="this.value = this.value.replace(/[^a-z]/, '')" />
4
solved if condition not working in javascript, when called from a textbox