New to JavaScript and have a basic problem
<p>I am new to web programming and am having a problem calling a JavaScript function on a form button click. Instead of calling the function and executing the alert() it will reload the page, and reset the data that was entered into the text boxes. I am sure this is a simple error, but I am having trouble figuring this one out.</p>

<p>This is the code I have for my HTML form button</p>

<pre><code>&lt;input type="button" name="submitbutton" id="submitbutton" onclick="submit()" value="Submit Answer" /&gt;
</code></pre>

<p>And this is the function I am calling, without success</p>

<pre><code>function submit(){
    alert("working");
    var answer=document.getElementById(answerText).value;
    alert(answer);
    if(movieArrayRand[0].answer==answer)
        {
            alert("You Win");
        }
    else{alert("You Lose");}
}
</code></pre>

<p>Any help would be great</p>
