I have a program where the user enters a sentence and the input is compared against an array when the user clicks the submit button the function "checkSentence() should be called but this does not happen. would really appreciate it if someone told me what's wrong wth my code
<script type="text/javascript">
var noun=["cat","mat","rat"];
var verb=["like","is","see","sees"];
var object=["me","the","a"];
var subject=["I","a","the"];
var sentence=subject.concat(verb,noun,object);
var userInput=document.getElementById("idTextArea").value;
function compareSentences(){
if (userInput==sentence.length){
alert("congratulations! Your sentence is correct");
return false;
}
else if(userInput==null||userInput=="");
{
alert("your text was blank, please enter a valid sentence")
}
else
alert("Your Sentence does not follow micro-english rules,Please enter a micro-English sentence in the form of a subject, verb and object");
return false;
}
</script>
<body>
<div id="header">
<img src=http://www.myfreebannercreator.com/banners/4092135978862643.png alt="logo">
<br/>
<h1><font face="comic sans ms">Micro-English</font></h1>
</div>
<h1><font size="3" color="black" face="comic sans ms">Welcome to Micro English</font></h1>
<p>Micro English is a mini version of English with a limited vocabulary. You may only use the following</p>
<dl>
<dt>Nouns</dt>
<dd>Cat, Mat,Rat</dd>
<dt>Verbs</dt>
<dd>Like,is,see,sees</dd>
<dt>objects</dt>
<dd>me,the,a</dd>
<dt>Subjects</dt>
<dd>I,a,the</dd>
</dl>
<h2><font size="2" color="blue" face="comic sans ms">Please Enter a sentence in micro English in the box below</font></h2>
<form onsubmit="checkSentences();">
<p><font face="tempus sans itc">Please Enter a sentence in micro English</font></p>
<input type="text" name="input" id="userInput"/>
<input type="submit" value="go" onclick="compareSentences();"/>
</form>