title: To show error message without alert box in Java Script
body: <p>Please correct the below code it is not working as expected i.e, i need a error message to be shown just beside the textfield in the form when user enters an invalid name</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;script type="text/javascript"&gt;
    function validate() {
    if(myform.fname.value.length==0)
    {
     document.getElementById("fname").innerHTML="this is invalid name ";
    }
    }
    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;form name="myform"&gt;
    First_Name
    &lt;input type=text id=fname name=fname onblur="validate()"&gt; &lt;/input&gt;
  
    &lt;br&gt; &lt;br&gt;
    Last_Name
    &lt;input type=text id=lname name=lname onblur="validate()"&gt; &lt;/input&gt;
  
    &lt;br&gt;
    &lt;input type=button value=check&gt; 
  
    &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>