events - my javascript function is not called on button click -


i have code:

<script language="javascript"> var noun=["cat","mat","rat"]; var verb=["like","is","see","sees"]; var object=["me","a+noun","the+noun"]; var subject=["i","a+noun","the+noun"]; var sentence=(subject+verb+object);  function checkcorrectness(){     var input=document.getelementbyid("userinput");     if(input==sentence)         {         alert("congratulations sentence correct");         }     else if(input=="null"||"")         {         alert("your entered blank text, please enter sentence");         }     else{         alert("sorry, sentence incorrect, sentence should in form of subject, verb , object. please try again");         } }; </script> </head> <body> <h1><font size="3" color="black" face="comic sans ms">welcome micro english</font></h1> <h2><font size="2" color="blue" face="comic sans ms">please enter sentence in micro english in box below</font></h2>  <form onsubmit="checkcorrectness();"> <input type="text" name="input" id="userinput"/> <input type="submit"value="go"/> </form> 

but when click "go" button nothing happens.what problem? have tried changing type of input has never ran, had similar program did run cnt put finger on problem here. please help

this code working ..

 <script language="javascript"> var noun=["cat","mat","rat"]; var verb=["like","is","see","sees"]; var object=["me","a+noun","the+noun"]; var subject=["i","a+noun","the+noun"]; var sentence=(subject+verb+object);  function checkcorrectness(){     var input=document.getelementbyid("userinput").value;     if(input==sentence.length)         {         alert("congratulations sentence correct");         }     else if(input==null || input =="")         {         alert("your entered blank text, please enter sentence");         }     else{         alert("sorry, sentence incorrect, sentence should in form of subject, verb , object. please try again");         } }; </script> </head> <body> <h1><font size="3" color="black" face="comic sans ms">welcome micro english</font></h1> <h2><font size="2" color="blue" face="comic sans ms">please enter sentence in micro english in box below</font></h2>  <form onsubmit="checkcorrectness();"> <input type="text" name="input" id="userinput"/> <input type="submit"value`enter code here`="go"/> </form> 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -