title: How to use html form validation to display image
body: <p>I have created an HTML form in which there are a number of different text boxes. What I want to do is to create a javascript script that will display little images next to the boxes that have no text in them. Here is an example of what I want to do:</p>
  
  <p><img src="https://i.stack.imgur.com/ENUKA.png" alt="enter image description here"></p>
  
  <p>At the moment I have created the following script which validates the form as I'd like, however it only displays a popup box since I don't know how to display images/text. Here is the code I have:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
      function validateForm()
      {
          var x=document.forms["email_form"]["name"].value;
          if (x==null || x=="")
          {
              alert("Please enter your name in the box provided.");
              return false;
          }
  
          var x=document.forms["email_form"]["email"].value;
          if (x==null || x=="")
          {
              alert("Please enter your e-mail address in the box provided.");
              return false;
          }
  
          var x=document.forms["message-title"]["name"].value;
          if (x==null || x=="")
          {
              alert("Please enter a message title in the box provided.");
              return false;
          }
  
          var x=document.forms["email_form"]["message"].value;
          if (x==null || x=="")
          {
              alert("Please enter your message in the box provided.");
              return false;
          }
      }
      &lt;/script&gt;
  </code></pre>
  
  <p>Please can someone point me in the right direction?</p>