mercredi 24 juin 2020

How do i redirect page based on user input?

Using javascript , I am trying to set up a page redirect based on user input from a text box. When i fill out the text box, each if condition is met but the page is not redirecting, i have no idea why , am i on the right lines ? I am fairly new in my learning so any advice would be great. Is this the way to go about this and if so what have i dont wrong, thanks all

 <script type="text/javascript"> 

  function validateTextBox() { 

var box = document.getElementById("width")
var box2 = document.getElementById("height")
var box3 = document.getElementById("length")

 if (box.value < 25 && box2.value < 25 && box3.value < 25) {
 window.location.href = "jointext.html";
}                               
}                                

</script>
 
</head>

<body>


<form id= "theform" action="" method="post" onSubmit="validateTextBox()"> 

Aucun commentaire:

Enregistrer un commentaire