Validate textfield and add warning-text right to textbox
<p>I'm trying to add a warning-text right to my textfield when the name is not valid. I have the code for the validation but i can't make some text appear when it input is invalid.</p>

<p>HTML-code:</p>

<pre><code>&lt;label for="fname"&gt;Firstname:&lt;/label&gt; 
&lt;input type="text" name="Firstname:" id="fname" size="40" /&gt;
</code></pre>

<p>Javascript-code:</p>

<pre><code>fname.onchange = function() {
    var fn = /^[a-z\s]{2,30}$/i;
    if(!(fn.test(fname.value))) {
        //Insert text right to the textbox here!

    }
}
</code></pre>
