javascript function input validation
<p>I am trying to write a javascript function which is called input() (performing input validation) and it will contain 3 arguments - the arguments are message, min and max.</p>

<p>I am having trouble bringing/writing the the function as a whole, have managed to work out bits of the function though - any help appreciated!</p>

<p>Code so far:</p>

<pre><code>    // declare variables

var min = 5
var max = 20
var message = 'input must be between 5 and 20';

// get user input
input = parseInt(prompt(message));

// check range
while(isNaN(input) || input&lt;min || input&gt;max) {
    alert('input was invalid');
    input = parseInt(prompt(message));
}

// output validation
alert('input was accepted');
</code></pre>

<p>(from <a href="http://jsfiddle.net/AnJym/2/" rel="nofollow">http://jsfiddle.net/AnJym/2/</a>)</p>
