How to make a counter start at 1 and go to three after a button is clicked in javascript? : <p>I'm trying to make a counter that starts at 1 and after you click a button it will display an alert and then the counter will go to 2 and wait until you click the button again and then give you a different alert and so on.</p>

<pre><code>I have tried something along the lines of

//html
&lt;input id="button" type="submit" name="button" value="enter"/&gt;

//javascript
function count()
{
var counter = 1;
if(counter = 1 &amp;&amp; button.click)
{
alert("something"(counter++));
}
if(counter = 2 &amp;&amp; button.click)
{
alert("something else"(counter++));
}
if(counter = 3 &amp;&amp; button.click)
{
alert("something else else");
}
}
</code></pre>

<p>I know that the syntax isn't correct but that's the main idea. The expected output should be a new alert after each button click.</p>
