title: checking the content of a text field before submitting PHP form
body: <p>I have a form on a web page with an email address text box that has default text 'enter your email address'. </p>
  
  <p>Attached to an image on the form was a function called myfunc() that simply submitted the form. What I'm trying to do is adapt this form, so that IF the email text box still contains the default text 'enter your email address' then rather than submitting the form, a hidden div is shown (or similar). At the moment I'm testing by using a redirect in this part. </p>
  
  <p>Can anyone see what I've done wrong with my javascript? I thought it would be quite simiple. </p>
  
  <pre><code>&lt;!--Javascript to submit form onclicking submit div--&gt;
  &lt;script type="text/javascript"&gt;
      function myfunc () {
          var searchtext = document.getElementById("emailsubmit").value;
          var frm = document.getElementById("myemailform");
          if (searchtext=='enter your email address')
          {
          window.location.href = "http://stackoverflow.com";
          }
          else 
          {
              frm.submit();
          }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>My form:</p>
  
  <pre><code>  &lt;form action="functions/function-email.php" method="post" name="myemailform" id="myemailform"&gt;
        &lt;input type="text" id="emailsubmit" name="email" onfocus="if(this.value=='enter your email address') this.value = ''" onblur="if(this.value=='') this.value = 'enter your email address'" value="enter your email address" size="50" maxlength="50"&gt;
  
      &lt;div class="send_request_button" &gt;
      &lt;img src="images/purple.png" width="400" height="100" onClick="myfunc();"/&gt;
      &lt;/div&gt;
  
    &lt;/form&gt;
  </code></pre>