jquery - Javascript and html: button isn't working -


i making program has array of numbers , user inputs values in , clicks on verify. value enters has in order array of numbers , if isn't user gets alert message sorry value inside first input bar decides number of array should comparison should start. example, if array holds numbers {2,4,6,8,10} , user enters 6 in first input bar , enters 8 , 10 in next 2 bars, should result "678" if doesn't first number right lets enters 3, , since 3 isn't in array, doesn't matter enters in other input bars, result "sorry". similarly, if user types 4 in first input bar then in second bar types 8, should still result "sorry" since order of array {4,6,8} not {4,8}.. now, made program thing is, whenever click on verify button, nothing happens :/.. here codes. , here result getting: https://jsfiddle.net/53j19rpt/

<html>  <head> </head> <script type="text/javascript">     var arr = [];     var t;     var num = 2;     var x = [];     (var x = 0; x < 4; x++) {         document.getelementbyid("one" + x);     }      function go() {         (var t = 0; t < 4; k++) {             x[t] = num * (t + 1);         }         (var k = 0; k < 4; k++) {             if (document.getelementbyid("one0").value >= x[k])                 if (document.getelementbyid("one" + k).value == x[k])                     document.write(document.getelementbyid("one" + k).value);                 else                     document.write("sorry");         }     } </script>  <body>     <input id="one0" type="text">     <input id="one1" type="text">     <input id="one2" type="text">     <input id="one3" type="text">     <input type="button" id="verifybtn" value="verify" onclick="go()"> </body>  </html> 

check

for (var t = 0; t < 4; k++) {             x[t] = num * (t + 1);         } 

code going infinite loop here. value of t not getting incremented in code.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -